access_time 10 days ago languageEnglish

Git - Push Tags and Commits Atomically

visibility 8 comment 0


When adding tags to a certain commit in git local repository, it might be important to push the tags and commits to remote repository simultaneously to ensure CI/CD pipeline is triggered correctly. For example, if build pipeline has steps that are created with custom condition which is based on tag patterns. For this scenario, you may not want to trigger the pipeline until the tag is pushed. 

To push tags and commits simultaneously, you will need to use different commands in different version.

From git 2.4

Since Git 2.4, we can use the following command to push tags and commits at the same time:

git push --atomic origin <branch name> <tag>

For example, the following command push the commits to origin master branch together with tag reference tag-name

git push --atomic origin master tag-name


Push git commits & tags simultaneously - Stack Overflow

copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Follow Kontext

Get our latest updates on LinkedIn or Twitter.

Want to contribute on Kontext to help others?

Learn more

More from Kontext

visibility 878
thumb_up 0
access_time 6 years ago
visibility 30
thumb_up 1
access_time 3 months ago