Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pros and cons of using git revisions instead of branches as references for rollouts

I am working on a phing script with git for build automation, and am still new to it. To give a little idea, we plan to have multiple branches in our project, and any of them could be rolled out (we are almost certain about this part).

During the course of development of my thought process for implementing the build script, I considered providing the git branch as an input to the build script for some time, then switched to providing the git revision instead (which could belong to any branch). Now, as my knowledge is increasing further, I am again in favor of using git branch references.

I would like to explore all the pros and cons of having either of these, which people have experienced, so that others have some reference to begin with.

The latest problem with using revisions that I realized today is that, it seems, I will have to pull all the branches to local in order to be able to find the one containing the revision, so that I can then move the working directory to that revision. Check How to take local working directory to any git revision irrespective of its branch after remote changes?.

like image 392
Sandeepan Nath Avatar asked Dec 05 '25 07:12

Sandeepan Nath


1 Answers

If you want to refer to a specific revision, create a tag. Tags are meant for things like identifying specific builds and released versions. A tag points to a specific commit just like a branch head does, but unlike a branch head, it doesn't change as additional commits are added.

like image 181
Wyzard Avatar answered Dec 06 '25 22:12

Wyzard



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!