Push merge to GitHub using git #21856
-
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]
[on test] [make change to file.txt]
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.
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? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
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:
To get the status you need to run the git status command:
The status give a hint of what you need to do, for example a push:
This command put every changes made on local into origin (if there isn’t conflicts). Hope this helps 🙂 -Gabriele-
|
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
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:
To get the status you need to run the git status command:
The status give a hint of what you need to do, for example a push:
This command put every changes made on local into origin (if there isn’t conflicts).
Hope this helps 🙂
-Gabriele-