Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"git push" and "git push --tags" in the same command?

I usually run:

git push git tag v4.7 git push --tags 

Both the first and third operations connect to the server, which wastes time.
I want to make it faster by pushing only once. What command(s) would achieve this?
It is in a bash script, and needs to run fine in any branch, not just master.

Reading the manual, I don't think git push all is the solution:

--all: Instead of naming each ref to push, specifies that all refs under refs/heads/ be pushed.

--tags: All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line.

like image 264
Nicolas Raoul Avatar asked Oct 16 '13 13:10

Nicolas Raoul


People also ask

Does git push also push tags?

Sharing tags is similar to pushing branches. By default, git push will not push tags. Tags have to be explicitly passed to git push .

What happens if two people push to git at the same time?

If server detects a conflict when someone pushes data (and if two users are doing this "simultaneously" one of the pushes will be conflicting, because it will be applied only after the other one completes), the server will reject it, and the unlucky user shall then resolve conflicts and try to push again.

How do you push all tags?

Push all git tags to remote And if you want to push all tags from your local to the remote then add "--tags" to the git command and it will push all tags to the remote.

What is the difference between git push and git push?

Git push origin is usually used only where there are multiple remote repositories and you want to specify which remote repository should be used for the push. For a git push origin command: git push command updates remote references using local references by sending objects necessary to complete the given references.


1 Answers

The closest option may be:

git push --follow-tags 

Push all the refs that would be pushed without this option, and also push annotated tags in refs/tags that are missing from the remote but are pointing at committish that are reachable from the refs being pushed.

like image 53
Kornel Avatar answered Sep 23 '22 04:09

Kornel