Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 3

Push merge to GitHub using git

Solved! Go to Solution.

Hello. I have a laptop and a pc, and I would like to be able to switch between working on them using GitHub. I would like to interact with GitHub using git on the command line. I have run into some problems when merging branches.


I have a branch, say 'test', and master. I want to merge test to master through the command line with git, then push this to github. However, on github the test branch isn't labeled as merged. This is my workflow:


[on master]

- git checkout -b 'test'

[on test]

[make change to file.txt]

- git add file.txt

- git commit -m "A change to file.txt"

- git push origin test


The new branch appears on github, with the change to file.txt showing.


Now say I have made a few commits to test, and want to merge. I know I can start a pull request on the GitHub website and merge, but I would like to do this locally on the command line and push this merge to GitHub.


- git checkout master

- git merge test


which updates file.txt on master locally. I would now like to push these changes, including the merge, to GitHub. However, both 'git push origin master' and 'git push origin test' don't show the 'test' branch as being merged when I go onto GitHub. There is still a branch called 'test' on GitHub and there is a button next to it that says 'New pull request' rather than the usual purple 'merged' that appears if you merge on GitHub directly.


Does anyone know where I am going wrong?

2 Replies
Commander Lvl 2
Message 2 of 3

Re: Push merge to GitHub using git

Hi @liamdbarber,


You miss a push of master. If you get the status of the local branch master of repository i think it says something like this:

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working tree clean

To get the status you need to run the git status command:

git status

The status give a hint of what you need to do, for example a push:

git push origin master

This command put every changes made on local into origin (if there isn't conflicts).


Hope this helps 🙂  




Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!
Ground Controller Lvl 1
Message 3 of 3

Re: Push merge to GitHub using git

You know why he missed that 'git push'? Because almost every freakin' piece of documentation that deals with branches conveniently leaves out that "push". They talk freely about creating and checking out 'newbranch', making changes to it, doing an 'add' to it, committing to it, then checking out the master, and then merging 'newbranch' into master. Then they stop. No mention of a "push" so that the code change actually is reflected in the GitHub repository.  None .. nada ... stackoverflow is even worse, with all the various and weird scenarios people come up with to make a simple change to a file. It boggles the mind how ridiculous this is.