Git Tutorial: Understanding Git pull and branches (using a specific example repo)

Backlight

Suppose I have the following git urls (hosted on github)

http://github.com/mikl/drupal.git git://github.com/mikl/drupal.git (Git read-only) 

I am interested in having a local copy of this repository so that I can work with branches in Git and see how my local tree can change depending on which branch I'm working with.

Questions:

  • To get started, I set up a local directory and make Git clone git: //github.com/mikl/drupal.git ... Will it clone all branches? Or will he only clone the master?
  • The web interface for github gives me a drop-down menu that allows me to switch between branches ... Does this change the drop-down menu, which branch will I grab when I run Git clone?
  • If I need a new copy of this repository on my local machine, but I'm only interested in two branches of this repository, and I want to ignore everything else, which command I use to ensure that only these two branches are cloned and nothing else (suppose one of the branches is a master)?
+1
source share
1 answer
  • He will clone all branches. However, no local branches have been created for anything but a wizard. You can view remote branches with git branch -r and create a local tracking branch with git branch localname origin/remotename
  • No.
  • A multi-step process that I suggest you not to bother (create a repository, configure a remote one, make partial remote control selections).
+4
source

Source: https://habr.com/ru/post/1333624/


All Articles