Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the -a flag mean when using git pull -a origin develop?

Tags:

git

pull

Normally when I want to update my project from a remote repository I use the following command line.

git pull -a origin develop

I learned this from my project team members but I could not find the answer on the Internet what the -a flag does. What does the -a mean?

like image 926
O Connor Avatar asked Dec 02 '16 23:12

O Connor


1 Answers

The git pull command is essentially just a convenience shortcut.1 It first runs git fetch, then it runs another Git command. The second Git command defaults to git merge, but under various circumstances, you can make the second command be git rebase.

This is all that git pull does: It runs two other Git commands. All options and arguments to git pull either control which second command it uses, or are passed on, usually directly, to one of the other commands.

In this case, -a or --append is passed on to git fetch, which tells it to append all of the fetched references to the FETCH_HEAD file (rather than replacing any existing FETCH_HEAD file iwth fetched references). Unless you are using FETCH_HEAD yourself, this option is useless.


1Since the best second command to run can depend on the result of the first command, as conveniences go, this one is really very inconvenient. It's like having to decide whether to walk, drive, or fly to a destination before you know whether it's in your neighborhood, in your city, or in another continent.

like image 107
torek Avatar answered Nov 01 '22 12:11

torek