How To Use Git Rebase
1 min read

I will use these two branches in this example:

  • dev - the main branch
  • feature - the newly created branch

Always rebase before a merge

# Checkout New Branch
> git checkout -b feature

# Make Commits
> ...

# Make a Pull with Rebase Before Merge (if Long Branch, Do Occasional Rebases)
> git checkout dev
> git pull --rebase
> git checkout feature
> git rebase dev

# Merge when Done
> git checkout dev
> git merge feature

# Delete Branch
> git branch -d feature