Commits not being pushed to origin
I changed some files locally, added them, and committed them. When I try to push this branch to origin so that I can open a merge request, it seems that it isn’t pushing any changes since the Total is 0
~/work/pr $ git commit -m "something" [master e9bd370] something 5 files changed, 86 insertions(+), 11 deletions(-) create mode 100644 arrows.png create mode 100644 foo.html ~/work/pr $ git push origin newbranch Total 0 (delta 0), reused 0 (delta 0) To firstname.lastname@example.org:user/my-repo.git * [new branch] newbranch -> newbranch
The above lets me open a new merge request on GitLab webpage, however, says “nothing to merge”. Which is because the
Total 0 in the above terminal output.
- Webhooks for branching in Gitlab
- Git directly commit file to git and/or gitlab
- How to set config for gitlab?
- How to add one folder on different branch
- GitLab: is there a way to assign a status/comment to a branch?
- Project Documentation: Create wiki pages, or create Markdown files in the repo?
2 Solutions collect form web for “Commits not being pushed to origin”
That looks totally normal. Your “newbranch” clearly has nothing new to add to the conversation.
I assume you were here:
git checkout master # whatever the current branch is, assuming master
You probably meant to do, starting from above:
git commit -m "Something" git branch -f newbranch # re-position the new branch git push origin newbranch
That’s not the best practice, though. You should have done:
git checkout newbranch # get the "newbranch" updated with the latest available "good stuff" git merge master # work on something and commit git commit -m "Something" git status # "git graph" here would be very useful to look at (see extra hint, below) git push origin newbranch
PS. Extra tip – Use a handy alias
git graph to visualize your branches while working, basically a super-powered
git log /
git status (more like log, less like status). https://sites.google.com/site/sudokillall9/articles/gitgraphvariants
According to your commit result, it looks like you were on
master when you made the commit.
Since you are committing it to
master, instead of
newbranch, nothing in
newbranch was changed.
You need to checkout the
newbranch branch before committing / pushing if you want to update that one.