Git rebase

Jayson Hwang·2022년 6월 12일
0

git rebase Process

  1. git add .
  2. git commit - m "content"
  3. combining multiple commints tinto one ::
    git rebase -i BASE~(number ex. 3)
  4. rebase main ::git rebase -i main

Git Merge

Pros

  • Simple and familiar
  • Preserves complete history
  • Maintains the context of the branch

Cons

  • Commit history can become polluted by lots of merge commits
  • Debugging using git bisect can become harder


Git Rebase

Rebases are how changes should pass from the top of the hierarchy downwards, and merges are how the flow back upwards

Pros

  • Streamlines a potentially complex history
  • Manipulating a single commit is easy
  • Avoids merge commit "noise" in busy repos with busy branches
  • Cleans intermediate commits by making them a single commit, which can be helpful for DevOps teams

Cons

  • Squashing the feature down to a handful of commits can hide the context
  • Rebasing public repositories can be dangerous when working as a team
  • It's more work: Using rebase to keep your feature branch updated always
  • Rebasing with remote branches requires to yo force push. The biggest problem people face is they force push but haven't set git push default. This results in updates to all branches having the same name, both locally and remotely, and that is dreadful to deal with.
profile
"Your goals, Minus your doubts, Equal your reality"

0개의 댓글