Miss Clone: I get a fresh copy to local.
Mr Pull: I already have it locally, I just update it.
Miss Clone: I can do what you do! You are just my subset.
Mr Pull: Ditto!
Miss Clone: No, you don't create. This is what I do:
- Create empty bare repository in local computer.
- Populate remote-tracking branches (all branches in repo downloaded to local computer)
- Run git fetch without arguments
You only do #3, and then you merge(fetch + merge), which I do not need to do. Mine is fresh... girl!
Mr Pull: Smarty pants, no big deal, I will do a "git init" first! Then we are the same.
Miss Clone: No dear, don't you need a 'checked-out branch'... the git checkout? Who will do it? me!
Mr Pull: Oh right.. I need a checked-out local branch to act on. But wait.. you checkout master branch by default. Does anyone work on master branch? No! You are delivering a feature that is perhaps never used! I let the user decide the best branch to checkout and that is how I roll!
Git creators: Hold your horses Mr Pull, if --bare or --mirror is used with clone or init, your merge won't happen. It remains read-only. And for you Miss Clone, git checkout can be replaced with a git fetch <remote> <srcBranch>:<destBranch> unless you want to use a -s <strategy> with pull which is missing in fetch.
Miss Clone: Somehow I feel like a winner already but let me drop this too: my command applies to all the branches in the repository. Are you that broad minded Mr. Pull?
Mr. Pull: I am broad minded when it comes to fetching all the branch names(just the 'name') from the repo. Because I don't like to fetch unnecessary branches. But the merge will happen only on the current checked out branch. Exclusivity is the name! And in your case too, you only check-out one branch.
Git Creators: Just one addition: Miss Clone can be restricted to just one branch if needed: git clone --single-branch --branch <branch name> <url>