4

I have several git repositories.

For every project I need a few of them (tags or branches).
After the project is finished I create a branch from the last commit.
Because the next Project there could be radical changes, so they may not be compatible to each other any more.

But is it better to just tag the commit first, and create a branch if I need it(bug fixes etc) afterwards?

Does it even matter?

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
user2071938
  • 2,055
  • 6
  • 28
  • 60
  • In your case, it would be more useful to create a tag (provided there is little likelihood of bugs. If you anticipate a lot of development work, go for a branch). More in [this](http://stackoverflow.com/questions/1457103/how-is-a-tag-different-from-a-branch-which-should-i-use-here) answer. – TJ- Jun 03 '15 at 12:59
  • See http://stackoverflow.com/questions/1457103/how-is-a-tag-different-from-a-branch-which-should-i-use-here – jub0bs Jun 03 '15 at 13:25

1 Answers1

5

TJ is right: In one sense, branches and tags are both references to specific commits, so to some degree it doesn't matter; they will both function the same way for you.

A tag is better for your use case because tags don't move when additional commits are added. A branch reference follows HEAD on that branch, so if you check out a branch and make commits (maybe accidentally) that reference will change; if you check out a tag and add commits, the tag reference will stay the same.

Community
  • 1
  • 1
pjmorse
  • 9,204
  • 9
  • 54
  • 124