Git rebase

 

The rebase command is used to bring changes from another branch, usually a branch from which the current branch migrated from. It is basically putting the changes on the base and not on top.



Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
git rebase commit-id(from the parent branch)
git rebase commit-id(from the parent branch)
git rebase commit-id(from the parent branch)

You can always rebase from master which is the source of truth.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# 1 - pull latest code from master
git checkout out master
git pull --rebase
# 2 - checkout out feature branch
git checkout create-swipe
# 3 - rebase feature branch from master
git rebase master
# 1 - pull latest code from master git checkout out master git pull --rebase # 2 - checkout out feature branch git checkout create-swipe # 3 - rebase feature branch from master git rebase master
# 1 - pull latest code from master
git checkout out master
git pull --rebase

# 2 - checkout out feature branch
git checkout create-swipe

# 3 - rebase feature branch from master
git rebase master

If you want to revert rebase in progress you run this command:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
git rebase --abort
git rebase --abort
git rebase --abort

 




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published. Required fields are marked *