Git How To
A bunch of useful commands and tips for using git.
Making a branch
Create a new branch
git branch my_branch
Make your changes, add files and commit them to your branch. Then push them to remote
git push origin my_branch
Make your fork track original upstream repo
git checkout master
git remote add upstream git@github.com:upstreamname/projectname.git
Now you can get updates from upstream
git fetch upstream
git merge upstream/master
To send these changes to your own remote
git push origin master
Rebase branch to master
git checkout masterÂ
git pull origin master
git pull upstream master
git checkout my_branch
git rebase master
The last step might indicate some conflicts which have to be resolved.
Delete branch which is not merged
git branch -D my_branch
git push origin :my_branch
Accepting and merging a pull request
git checkout master
git remote add contributor git://github.com/contributor/projectname
git fetch contributor
git merge contributor/newfeature
git push origin master