Skip to content

Latest commit

 

History

History
71 lines (31 loc) · 1.04 KB

git.md

File metadata and controls

71 lines (31 loc) · 1.04 KB

Git

Source: https://www.atlassian.com/git/tutorials/merging-vs-rebasing

Merge and Rebase

Both of these commands integrate one branch into another branch.

Merge

git checkout myBranch
git merge master

OR

git merge feature master	

Pros: non destructive

Cons: every merge will be its own commit.

Rebase

git checkout feature
git rebase master

Pros: cleaner project history (linear history)

Cons: more dangerous, and lose context.

Interactive rebasing:

git rebase -i

fixup: fixes a problem in the previous commit.

squash: merges commits.

Golden rule of rebasing: never use it on public branches!!

To push the rebased master branch to a remote repository, do git push --force

git rebase -i HEAD~3 : only rewriting the last three commits