Skip to content

Instantly share code, notes, and snippets.

@iuriimattos
Forked from lgmkr/git-rebase.markdown
Created December 3, 2020 04:53
Show Gist options
  • Save iuriimattos/bbec19f86543caa9aa1a7b1a0cda20d3 to your computer and use it in GitHub Desktop.
Save iuriimattos/bbec19f86543caa9aa1a7b1a0cda20d3 to your computer and use it in GitHub Desktop.
Git rebase workflow

Checkout a new working branch

 git checkout -b <branchname>

Make Changes

 git add
 git commit -m "description of changes"

Sync with remote

 git checkout master
 git pull --rebase

Update branch

 git checkout <branchname>
 git rebase master

Push Changes

 git checkout master
 git merge <branchname>
 git push

Squash Last N Commits

 git rebase --interactive HEAD~N

Conflicts

  1. Resolve conflict my looking at the files in question.
  2. git add
  3. git rebase --continue

Git Flow

 git flow init                             # setup project to use git-flow

 git flow feature start <feature_name>     # creates a new feature branch called <feature_name>

 git flow feature finish <feature_name>    # merge feature back into develop branch

 git flow release start <version>          # merge develop to release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment