Last active
November 6, 2022 09:13
-
-
Save DRSDavidSoft/b4cf15a0748f0b3fb00ced63df04d750 to your computer and use it in GitHub Desktop.
Working with git branches
This file contains 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
# fetch upstream branches | |
## git fetch upstream | |
# create local branch test from upstream master | |
git checkout -b test upstream/master | |
# do some stuff | |
git add src | |
git commit -m "did some stuff" | |
# see changes | |
git diff HEAD | |
# create remote branch test in origin and push changes to it | |
git push -u origin test | |
# push local master branch to remote development branch | |
git push origin master:development | |
# switch back to the local master branch | |
## git branch -a | |
git branch master |
This file contains 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
# list remotes | |
git remote -v | |
# change remote url | |
git remote set-url <remote-name> <remote-url> | |
# add remote | |
git remote add origin <remote-url> | |
git remote add upstream <remote-url> | |
# remove remote | |
git remote remove origin | |
git remote remove upstream | |
# push to a named remote and branch | |
git push -u origin master | |
# pull from origin | |
git pull origin master | |
# pull from upstream | |
git pull upstream master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment