So today I learned how to merge a branch into master branch. Here's my history log;
➜ MyApp git:(dev_gems) gs # On branch dev_gems nothing to commit (working directory clean)
master. This step is very self-explanatory.
➜ MyApp git:(dev_gems) git checkout master Switched to branch 'master'
While this step isn't required for merging branches, but it's good to know what's available (yeap
-a stands for available, I guess).
➜ MyApp git:(master) git branch -a dev_gems * master remotes/origin/dev_gems remotes/origin/master
Now the current branch should be
master as below;
➜ MyApp git:(master) gs # On branch master nothing to commit (working directory clean)
➜ MyApp git:(master) git merge dev_gems Updating 812c580..71a4752 Fast-forward Gemfile | 4 ++++ Gemfile.lock | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
All is done. Now a simple
git status would compare the status our repo status against
origin/master (which is could be your remote repo or github).
➜ MyApp git:(master) gs # On branch master # Your branch is ahead of 'origin/master' by 2 commits. # nothing to commit (working directory clean)
Perhaps you wanted to delete the merged branch. Here's how you do it;
➜ MyApp git:(master) git branch -d dev_gems Deleted branch dev_gems (was 71a4752).
➜ MyApp git:(master) git branch -a * master remotes/origin/dev_gems remotes/origin/master