2

I have a git archive which contains my dev code. Before pushing this into production, I need to delete quite a few unused source files. However, I want to keep those file around for reference.

So my thought is to create a branch of the current code and delete the unneeded files from HEAD. This would allow me to continue development under HEAD and still have the unneeded files for reference in my branch should I ever need them.

Does this seem like a valid approach or would I be mis-using branches if I did it this way?

user13955
  • 860
  • 2
  • 9
  • 25
  • 1
    Seems reasonable to me. Just name that branch adequately and make sure not to delete it, so you can access the deleted files if needed. Also, you may want to push the branch to some private remote repo, for backup purposes. – jub0bs May 19 '15 at 17:57
  • 2
    Why don't you use tags for that? If you are not going to continue adding changes to your back up I would use a tag instead of a new branch – Juan May 19 '15 at 20:05
  • @Juan You're right; using tags instead of branches would actually make more sense, here. Your comment echoes [this answer of mine](http://stackoverflow.com/questions/1457103/how-is-a-tag-different-from-a-branch-which-should-i-use-here/25874607#25874607). – jub0bs May 20 '15 at 08:29

1 Answers1

1

Yes, that would be a misuse of branches. There are two better options:

  1. Commit with some standard message (e. g. "cleanup" )
  2. git tag -m"feature_name cleanup"
Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67