Skip to content

Instantly share code, notes, and snippets.

@csarron
Last active July 24, 2020 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csarron/6d259b75479c20a0b5d3c95a4728f747 to your computer and use it in GitHub Desktop.
Save csarron/6d259b75479c20a0b5d3c95a4728f747 to your computer and use it in GitHub Desktop.
# 0. clone/fork repo,
# 1. add remote upstream
git remote add upstream https://github.com/xx/xx.git
# 2. checkout work branch
git checkout -b work
# If you are trying to "checkout" a new remote branch (that exists only on the remote, but not locally)
git fetch origin
git checkout --track origin/<remote_branch_name>
while not done:
# do the work, and commit to the work branch
# 3. sync with upstream
git pull --rebase # need to git branch --set-upstream-to=upstream/master work
# or below two steps
git fetch upstream
git rebase upstream/master
# 4. push to the remote work branch (should be ready to send pull request)
# if the pull request is merged, better checkout a new branch from the upstream/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment