0

I have a branch named deliveries and on this branch, I have made some new changes to some files.

Then I ran the command git add . to stage the files. And after that I ran git commit (I forgot to add message text).

I closed the Terminal, and tried git push to push the updated branch into server but it didn't add the changes.

However when I say git status, it says:

Everything up-to-date

So how to push the new changes into repository correctly?

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
  • Did it show any error? Did you write the full command? git push - u "url" "branch-name"? – Simone Lungarella Jul 06 '21 at 09:54
  • Did you create a new commit? – Joshua Jul 06 '21 at 09:55
  • @konekoya Yes I have but didn't add the message for that –  Jul 06 '21 at 09:56
  • @SimoneLungarella No it justs say Everything up-to-date –  Jul 06 '21 at 09:57
  • If you have created a new commit, then you should have a new SHA that's different than the upstream one. – Joshua Jul 06 '21 at 10:00
  • Why you don't read the error message? Because when you `git push` a branch for the first time, you will get an error message stating exactly what you have to do... --> `git push --set-upstream origin deliveries`. Look at the answer from @Hemesh – SwissCodeMen Jul 06 '21 at 11:51

1 Answers1

2

If it is not a master branch first you have to do this,

git checkout <branch-name>
git push # (it will say has no upstream).
git push --set-upstream origin <branch-name>

Note: <branch-name> is the branch which you want to push

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
Hemesh
  • 107
  • 9