I have some trouble pushing some changes to a branch on GitHub. I am quite new to Git and I am sure either I made something silly or I missed seomthing obvious, but I can't see what.
I made a fresh clone of one of my repos (actually a fork on GitHub), then switch to an existing branch, made some changes, and committed them. All I want is to push them back to GitHub. But "git push" says "Everything up-to-date", even though "git status" says that my local branch is ahead of the origin's branch by one commit:
> git checkout -b mystuff origin/newstuff
Switched to a new branch 'mystuff'
> echo "Make some changes..." >> file.txt
> git commit -m "Change." file.txt
[...]
> git status
# On branch mystuff
# Your branch is ahead of 'origin/newstuff' by 1 commit.
#
nothing to commit (working directory clean)
> git push
Everything up-to-date
Any idea what I missed?
git push origin mystuff
Just git push
will push on the default branch, which is usually set as master
.
Extra tip: the -u
option for git push
will set a new default branch, so if you run
git push -u origin mystuff
you can subsequently just do git push
and push on mystuff
without specifying the branch anymore.