From 0286eb33145b8830170b08bbbffbd6afa3b3b65c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ni=20Marvaud?= <24732919+lmarvaud@users.noreply.github.com> Date: Wed, 21 Mar 2018 20:24:10 +0100 Subject: [PATCH] Add change a branch base tips Based on : https://stackoverflow.com/questions/10853935/change-branch-base Tested on `git version 2.11.0 (Apple Git-81)` : ```bash-4.3$ git --version git version 2.11.0 (Apple Git-81) bash-4.3$ git checkout -b test-rebase-onto Switched to a new branch 'test-rebase-onto' bash-4.3$ touch "test-to-rebase" bash-4.3$ git add test-to-rebase bash-4.3$ git commit -m "Commit to rebase" [test-rebase-onto 11d1cdd] Commit to rebase 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test-to-rebase bash-4.3$ git log bash-4.3$ git rebase --onto master dev Applying: Commit to rebase bash-4.3$ git log``` --- README.md | 6 ++++++ tips.json | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index f13ee01..8d5064c 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`. * [Show git status short](#show-git-status-short) * [Checkout a commit prior to a day ago](#checkout-a-commit-prior-to-a-day-ago) * [Push a new local branch to remote repository and track](#push-a-new-local-branch-to-remote-repository-and-track) +* [Change a branch base](#change-a-branch-base) @@ -1167,5 +1168,10 @@ git checkout master@{yesterday} git push -u origin ``` +## Change a branch base +```sh +git rebase --onto +``` + diff --git a/tips.json b/tips.json index 6de1373..66846f8 100644 --- a/tips.json +++ b/tips.json @@ -493,5 +493,9 @@ }, { "title": "Push a new local branch to remote repository and track", "tip": "git push -u origin " + }, { + "title": "Change a branch base", + "tip": "git rebase --onto " } + ]