Skip to content

Instantly share code, notes, and snippets.

@avesus
Last active August 27, 2015 19:25
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 avesus/c1c1db042f6fc640ba0f to your computer and use it in GitHub Desktop.
Save avesus/c1c1db042f6fc640ba0f to your computer and use it in GitHub Desktop.
Git Subtles

Adding remotes

git remote add local_remote_name https://github.com/user/repo.git
git remote -v

Refresh data:

git fetch base_remote_name

Squash before rebase needs rebasing over common parent

To show common base:

git merge-base my_branch base_branch

to "rebase" for only squash/reorder purpose:

git rebase -i ${HASH}

Note: you could use reword to rename commit messages only

Rebasing

git rebase base_remote_name/base_branch_name

Rebasing with conflicts

git checkout mybranch
git rebase theirsbranch
... foo/bar.java conflict. We want the version that was at the head of branch1 
... which was popped off and applied after branch2's commit(s).
git checkout --theirs foo/bar.java
git add foo/bar.java
git rebase --continue

Overall status at every point

git status

Also look @ https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request for simple process description.

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