Skip to content

Instantly share code, notes, and snippets.

@haixuanc
Last active September 30, 2018 19:47
Show Gist options
  • Save haixuanc/c184b153c347a29c74b0 to your computer and use it in GitHub Desktop.
Save haixuanc/c184b153c347a29c74b0 to your computer and use it in GitHub Desktop.
Git workflow
  1. Hide local changes:

    $ git stash
  2. Fetch remote changes:

    $ git fetch <remote name> <remote branch>
  3. Rebase remote changes:

    $ git rebase <remote name>/<remote branch>
  4. [Optional] Resolve conflicts and continue rebase:

    $ git add <conflicted file>...
    $ git rebase --continue
  5. Check history to verify that local commits are on the top of the log stack:

    $ git log
  6. Re-apply local changes and run tests to verify if commits are ok:

    $ git stash pop
  7. Push to remote:

    $ git push <remote name> <remote branch>
    
    # Or if you want to push to a remote branch with a different name
    $ git push <remote name> <local branch>:<remote branch>
  8. Submit a merge request on the website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment