Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git tags not pushed to remote yet

Tags:

git

In Git, I created some local tags, and only some of them I wanted to push to origin.

After a while, I want to check what tags were missed from pushing to remote.

do we have command to show all tags which are in the local repo but not pushed to remote repo yet?

Thank you.

like image 533
soMuchToLearnAndShare Avatar asked Jan 08 '23 06:01

soMuchToLearnAndShare


1 Answers

Considering a git push can also push tags, you could use the git push --dry-run to preview a push and see if tags are pushed or not.

git push --tags --dry-run

That would list the local tags which are not present on the remote.
If the output is empty, all tags are already pushed.

Note that, as mentioned in "How can I see what I am about to push with git?":

The problem with git push --dry-run is that it still requires write permission at the remote.
So if you have a clone without permission to push upstream, but you'd like to see what your local unpushed changes are, --dry-run won't do it.

In that case, the scripting solution mentioned by knittl in the comments (git ls-remote --tags origin vs. git tag) is another option.

like image 139
VonC Avatar answered Jan 16 '23 02:01

VonC