Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push --tags not pushing master?

Tags:

git

I'm migrating some versions of a project manually into git, so I have done the following:

  1. created an empty project on remote then did a clone in an empty folder and checked I was on master and it said branches up to date with origin/master
  2. copied my first version into the folder
  3. git add .
  4. git commit -m "xxx"
  5. git tag -a "Vx.x.x" -m "xxx"

Then I repeated the above for all my versions and when I had finished all versions I ran: git push --tags

when I checked the server all tags were there with all files and full history, but master was still the same empty project with just the readme.md file, and on checking git status it said I was 6 versions behind.

So I ran git push and it was ok after that.

Did I do something wrong in my steps as I presumed after each commit master would be updated and push with --tags would push everything.

thanks.

like image 444
Neil Walker Avatar asked May 18 '26 01:05

Neil Walker


1 Answers

From comment: As per the documentation: --tags: "All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line." - If you didn't explicitly mention any refspecs, git push --tags pushes only tags. It will push enough commits to be able to store the tags, but it will not update remote branches.

You can automate it via: Push git commits & tags simultaneously

like image 173
Neil Walker Avatar answered May 20 '26 02:05

Neil Walker



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!