Skip to content

Instantly share code, notes, and snippets.

@jpwilliams
Last active August 3, 2017 13:12
Show Gist options
  • Save jpwilliams/2e111e41137f73f36ed56af07bd48038 to your computer and use it in GitHub Desktop.
Save jpwilliams/2e111e41137f73f36ed56af07bd48038 to your computer and use it in GitHub Desktop.
Guide for pulling from->to git branches

Pulling the same branch

If you're pulling the same branch from origin (origin/develop -> develop):

git checkout develop
git fetch origin
git pull --no-commit --log --rebase origin develop

SourceTree options:

  • Commit merge immediately (if no conflicts) --no-commit
  • Include messages from commits being merged in merge commit --log
  • Create a commit even if merge resolved via fast-forward
  • Rebase instead of merge --rebase

Cross-branch

Otherwise, always create a merge commit for merges like origin/feature/ISSUE-123 -> develop:

git checkout develop
git fetch origin
git merge --log --no-ff origin/feature/ISSUE-123

SourceTree options:

  • Commit merge immediately (if no conflicts)
  • Include messages from commits being merged in merge commit --log
  • Create a commit even if merge resolved via fast-forward --no-ff
  • Rebase instead of merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment