git diff commitid1 commitid2
=> diff two commid under repository
git log
=>check commit history
git checkout commit_id
B: try to add commit
git init
=> to create the repository under any directory you want , and then you can find a .git/ under
that directory.
use ls -a to find out .git/
git status
=> to check your repository status
git add filename
=>add the changed file to the staging area
git commit
=> add that file to repository
git diff
=> diff between local workspace and staging area
git diff --staged
=> diff between staged and latest commit
git reset --hard
=> to reset the staging file and your working area which means you will lose any changed you
did before. Be careful.
C:
git branch
=> to check all branch you have now.
git branch XXXname
=>create a new branch XXXname
git checkout XXXname
=> switch to that new branch
d:
git log --graph
=>check the commit id where it come from.
git merge branchA branchB
=>merge commits belong to branchA to branchB.
E: push to github
git remote
=> check your remote list
git remote add origin https://github.com/youraccount/repositoryName.git=>add your repository to your remote list
git push -u origin master=> push your local(master) repository to remote side(github,which is origin)
git origin -v=> check the link status of the remote side. fetch & push.
git pull origin master=> if remote side(github) has the updated ,pull it down to your local to let your local space data updated.
*local 改好之後 先 push add to staging area, 再push commit 到自己local repository .
*之後 再 push remote 把自己local 的repository 推上github 的