Ad

Turn The Branchs To Be Folders Of Master?

- 1 answer

I have a repo in Github.

repo:
 - master
 - a
 - b

I want to turn the branches(a, b) to be folders behind the master like master/a, master/b and delete a and b

Ad

Answer

I get the impression that you're misunderstanding how branches work. Check out this interactive tutorial which shows you what happens realistically when you branch off of master.

Now, for some verbal explanation:

  • The likely case is that each of your branches is already a child off of a commit from master.
  • There is no need to subclass your branch names underneath master, nor can you - you'd get an error that says something like, fatal: cannot lock ref 'refs/heads/master/foo': 'refs/heads/master' exists; cannot create 'refs/heads/master/foo'.
  • You can, however, name your branches similar to folders, so you could have hotfixes/release/18, for example.
  • You should stick to the basic convention of naming your branches after what they represent. If you need to figure out where it came from, you can use git log --graph --oneline --decorate to figure out where it came from originally.
Ad
source: stackoverflow.com
Ad