Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push fails in new branch

Tags:

git

So I created a new branch in git by doing the following:

git checkout -b newbranch master

I made some changes in newbranch and committed them. git log shows my changes just fine.

Now when I do 'git push', I just get 'Everything up-to-date' even though nothing was pushed to the remote repository.

I am on git 1.7.1

Grateful for any help!

like image 289
bruce Avatar asked Jan 30 '26 10:01

bruce


1 Answers

Git doesn't automatically push all branches. Usually master is the default branch to push, but you can specify by doing:

git push origin newbranch

Although, you might want to instead merge your newbranch back into your master branch and then push that.

Branches in Git are more geared towards your own personal development that doesn't need to be shared with everybody. One way to approach it is that you keep feature X hidden in a branch while you (and maybe a couple others) are hacking at it, and once feature X is done, you merge it back into master and then share it with the rest of the world.

like image 80
erjiang Avatar answered Feb 01 '26 02:02

erjiang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!