access_time 4 months ago languageEnglish
more_vert

Git - Push Tags and Commits Atomically

visibility 134 comment 0

Context

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

References

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.

Want to contribute on Kontext to help others?

Learn more

More from Kontext

visibility 1038
thumb_up 0
access_time 7 years ago
visibility 3729
thumb_up 2
access_time 4 years ago