Skip to content

Instantly share code, notes, and snippets.

@nuweb
Created October 20, 2015 20:28

Revisions

  1. nuweb created this gist Oct 20, 2015.
    29 changes: 29 additions & 0 deletions rebasing.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    1. Branch off of develop.
    $ git checkout -b feature/myfeature develop
    2. Squash commits into one commit
    Open github and figure out how many commits to go back
    $ git rebase -i head~(number of commits)
    - You can remove commits in editor by doing {command K}.
    - Save!
    3. Checkout develop and make sure it's up to date
    $ git checkout develop
    $ git pull
    4. Checkout feature branch and rebase develop
    $ git checkout feature/myfeature
    $ git rebase develop
    5. Use merge tool, resolve conflicts, and continue rebasing after diff merge
    $ git status
    $ git mergetool
    $ git rebase --continue
    5. Force Push feature branch
    $ git push -f
    6. Checkout develop and merge the feature branch
    $ git checkout develop
    $ git merge feature/myfeature
    7. Push
    $ git push
    8. Delete the feature branch
    $ git branch -D myfeature
    Notes: If anything goes wrong abort the rebase, delete and pull the feature branch and start again.
    git rebase --abort
    git branch -D myfeature