-
-
Save maicher/794eea6ebe72dc6852582a66434ab7bb to your computer and use it in GitHub Desktop.
Some useful git commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Managing own fork | |
### Configure upstream | |
git remote -v | |
git remote add upstream [email protected]:wimdu/wimdu.git | |
### Syncing to upstream | |
git checkout master | |
git fetch upstream master | |
git reset --hard upstream/master | |
git push origin master --force | |
### Rebasing branch | |
git checkout -b <branch> | |
git rebase master | |
git push origin <brach> --force | |
# Work on someone's elses fork | |
### Configure | |
git remote add agudulin [email protected]:agudulin/wimdu.git | |
git fetch agudulin | |
git checkout --track agudulin/branch_name | |
### Syncing | |
git reset --hard agudulin/branch_name | |
or | |
git pull agudulin branch_name --rebase | |
### Pushing | |
git checkout branch_name | |
git push agudulin branch_name | |
# Merging | |
git co master | |
git reset --hard upstream/master | |
git push origin master --force | |
git co <branch> | |
git rebase master | |
git push origin <brach> --force | |
git merge <branch> --no-ff | |
git push upstream master | |
# Extras | |
git rebase -i HEAD~4 | |
# More reading | |
- https://help.github.com/articles/configuring-a-remote-for-a-fork/ | |
- https://gist.github.com/Chaser324/ce0505fbed06b947d962 | |
- https://git-scm.com/doc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment