I would like to know the efficient way one person from my team could completely understand an unknown git repository from scratch (i.e. i don't provide them any detail) ?

Take the situation depicted herebelow


How could a person from my team quickly and efficiently know the complete structure of the repository ?

How can he know that two branches exist ?

How can he know the reasons of these two branches ? (assuming they will never be merged and will stay as is)

I am asking because it seems that to efficiently retrieve branches, one must first know that they exist. Or does cloning the entire repository and then do a git log is the right answer ?

  • Uh...run git branch --list? – Kayaman Nov 6 '17 at 12:33
  • Can you do that on a remote? – FenryrMKIII Nov 6 '17 at 12:40
  • 1
    From the documentation: Option -r causes the remote-tracking branches to be listed, and option -a shows both local and remote branches.. I suggest you all go through some Git tutorials, since these aren't even very advanced things. – Kayaman Nov 6 '17 at 12:43

You simply need to clone the repository, then do git branch --list (or just git branch) on your local machine to list out the branches.

When you clone a repository in git, you always get the complete history, including all branches.

As for knowing the reasons for the branch, git doesn't manage that. It's up to your team to manage the reasons for creating a branch. For example, you might want to require that the initial commit always includes a reason, or a link to a ticket in a ticket tracking system, or a link to a story in a story tracking system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.