git init
git config --global user.name "Renjith Narayanan"
git config --global user.email [email protected]
git clone /path/to/repository
git add <filename>
git add *
git commit -m "Commit message"
git commit -a
git push origin master
git status
git checkout -b branchname
git checkout branchname
git branch
git branch -d branchname
git push origin branchname
git push --all origin
git push origin :branchname
git pull
git merge <branchname>
git diff
git diff --base <filename>
git diff <sourcebranch> <targetbranch>
git add <filename>
git checkout -- <filename>
git fetch origin
git reset --hard origin/master
git config --global user.name "Renjith Narayanan"
git config --global user.email [email protected]
git init
git clone /path/to/repository
git clone username@host:/path/to/repository
git add <filename>
git add *
git commit -m "Commit message"
git commit -a
git push origin master
git status
git checkout -b branchname
git checkout branchname
git branch
git branch -d branchname
git push origin branchname
git push --all origin
git push origin :branchname
git pull
git merge <branchname>
git diff
git diff --base <filename>
git diff <sourcebranch> <targetbranch>
git add <filename>
If you mess up, you can replace the changes in your working tree with the last content in head: Changes already added to the index, as well as new files, will be kept.
git checkout -- <filename>
Instead, to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it, do this:
git fetch origin
git reset --hard origin/master
git reset HEAD~
git grep "foo()"