git rebase based workflow

Alejandro Dev.

merge


$ git merge master
          

merge


Merge pull request #560 from b2br-team/increase-connections-column-size
          

rebase


$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: added staged command
            

rebase -i


pick f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
pick a5f4a0d added cat-file

# Rebase 710f0f8..a5f4a0d onto 710f0f8
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
            

pick

use commit

reword

use commit, but edit the commit message

edit

use commit, but stop for amending

squash

use commit, but meld into previous commit

fixup

like "squash", but discard this commit's log message

Example

pick f7f3f6d First implementation
pick 310154e Fix
pick a5f4a0d Add resources
pick 76c587b Second implementation
pick 028c844 Fix implementation
pick dbcb44c Remove unused code
pick 16d4ce6 Remove white spaces
pick 25a674a Fix typo
pick 21d034b Change all code
pick 0e0a4ec Final version
                
reword f7f3f6d First implementation
fixup 310154e Fix
fixup 25a674a Fix typo
fixup 21d034b Change all code
fixup 76c587b Second implementation
pick a5f4a0d Add resources
fixup 028c844 Fix implementation
pick dbcb44c Remove unused code
pick 16d4ce6 Remove white spaces
pick 0e0a4ec Final version
                

After plausible merge conflicts...

f7f3f6d Base code
a5f4a0d Add resources
dbcb44c Remove unused code
16d4ce6 Remove white spaces
0e0a4ec Final version
            

Don'ts!

  • rebase pushed changes
  • rebase master
  • push -f

Do's

  • Use rebase
  • squash/fixup your local commits
  • when creating a commit think about revert

Bonus!

  • reword!
  • fixup!
  • squash!

Let's discuss!

Let's play