/* first, make sure you at least have the child branch */
git checkout feature/mychildbranch
/* ok, just show the branches. make sure at least feature/mychildbranch exists note the "*" below says "this is the branch i am on" */
git branch
* feature/mychildbranch
feature/myparentbranch
/* now checkout the parent branch...note the "switched" happens automatically with the checkout */
git checkout feature/myparentbranch
Switched to branch 'feature/myparentbranch'
Your branch is up to date with 'origin/feature/myparentbranch'.
/* not pull, the pull will occur on the branch you are currently on, which should be feature/myparentbranch at this point */
git pull
remote: Enumerating objects: 69, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 22 (delta 17), reused 0 (delta 0)
Unpacking objects: 100% (22/22), done.
From https://mygit.hub.com
96ae0e9..6eb0a03 feature/myparentbranch -> origin/feature/myparentbranch
* [new branch] feature/blah blah blah (specific to my stuff only)
xb99638..x86db6f master -> origin/master
Updating x6ae0e9..xeb0a03
Fast-forward
.../somefileone.txt | 30 ++++++++++++--------
.../somefiletwo.txt | 7 +++--
.../somefilethree.txt | 6 ++--
X files changed, Y insertions(+), Z deletions(-)
create mode 100644 somenewfileone.txt
/* do a git branch just to show that you're on feature/myparentbranch */
git branch
feature/mychildbranch
* feature/myparentbranch
/* ok, now (above) you have the latest-greatest feature/myparent, lets do a checkout on the child to switch to the child */
git checkout feature/mychildbranch
Switched to branch 'feature/mychildbranch'
Your branch is up to date with 'origin/feature/mychildbranch'.
/* another sanity check, show you're on feature/mychildbranch */
git branch
* feature/mychildbranch
feature/myparentbranch
/* finally, the magic. do a merge from feature/myparentbranch (which you know is local and up to date because of the voodoo above */
git merge feature/myparentbranch
Merge made by the 'recursive' strategy.
.../somefileone.txt | 30 ++++++++++++--------
.../somefiletwo.txt | 7 +++--
.../somefilethree.txt | 6 ++--
X files changed, Y insertions(+), Z deletions(-)
create mode 100644 somenewfileone.txt
git checkout -b child
git commit
git checkout master
git commit
git marge child
Note: In Git version 2.23, a new command called git switch was introduced
to eventually replace git checkout
/* first, make sure you at least have the child branch */
git checkout feature/mychildbranch
/* ok, just show the branches. make sure at least feature/mychildbranch exists note the "*" below says "this is the branch i am on" */
git branch
* feature/mychildbranch
feature/myparentbranch
/* now checkout the parent branch...note the "switched" happens automatically with the checkout */
git checkout feature/myparentbranch
Switched to branch 'feature/myparentbranch'
Your branch is up to date with 'origin/feature/myparentbranch'.
/* not pull, the pull will occur on the branch you are currently on, which should be feature/myparentbranch at this point */
git pull
remote: Enumerating objects: 69, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 22 (delta 17), reused 0 (delta 0)
Unpacking objects: 100% (22/22), done.
From https://mygit.hub.com
96ae0e9..6eb0a03 feature/myparentbranch -> origin/feature/myparentbranch
* [new branch] feature/blah blah blah (specific to my stuff only)
xb99638..x86db6f master -> origin/master
Updating x6ae0e9..xeb0a03
Fast-forward
.../somefileone.txt | 30 ++++++++++++--------
.../somefiletwo.txt | 7 +++--
.../somefilethree.txt | 6 ++--
X files changed, Y insertions(+), Z deletions(-)
create mode 100644 somenewfileone.txt
/* do a git branch just to show that you're on feature/myparentbranch */
git branch
feature/mychildbranch
* feature/myparentbranch
/* ok, now (above) you have the latest-greatest feature/myparent, lets do a checkout on the child to switch to the child */
git checkout feature/mychildbranch
Switched to branch 'feature/mychildbranch'
Your branch is up to date with 'origin/feature/mychildbranch'.
/* another sanity check, show you're on feature/mychildbranch */
git branch
* feature/mychildbranch
feature/myparentbranch
/* finally, the magic. do a merge from feature/myparentbranch (which you know is local and up to date because of the voodoo above */
git merge feature/myparentbranch
Merge made by the 'recursive' strategy.
.../somefileone.txt | 30 ++++++++++++--------
.../somefiletwo.txt | 7 +++--
.../somefilethree.txt | 6 ++--
X files changed, Y insertions(+), Z deletions(-)
create mode 100644 somenewfileone.txt
git checkout -b child
git commit
git checkout master
git commit
git marge child
Note: In Git version 2.23, a new command called git switch was introduced
to eventually replace git checkout