Skip to content

Instantly share code, notes, and snippets.

@CoralSilver
Forked from sheremetat/gitflow.md
Created June 19, 2018 13:25
Show Gist options
  • Save CoralSilver/5d2f9970eb4d8bc920927401e6f0b7da to your computer and use it in GitHub Desktop.
Save CoralSilver/5d2f9970eb4d8bc920927401e6f0b7da to your computer and use it in GitHub Desktop.
Git rebase workflow

Step 1: Checkout a new working branch from updated master

 git checkout -b <branchname>

Step 2: Make Changes

 git add
 git commit -m "description of changes"

Step 3: Sync with remote

 git checkout master
 git pull --rebase

Step 4: Update branch

 git checkout <branchname>
 git rebase master

 In case of conflicts: resolve conflict by looking at the files in question.
 git add <resolved files>
 git rebase --continue

Step 5: Squash your last N commits

 git rebase --interactive HEAD~N

Step 6: Push Changes

alternativelly create pull request and merge changes to master via UI

 git checkout master
 git merge <branchname>
 git push

Step 7: Delete working branch

 git branch -d <branchname>
 git push origin :<branchname>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment