Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backup git repos, git fetch vs git remote update

Tags:

git

github

I want to backup git repos using this SO answer: Backup a GitHub repository

git clone --mirror git://github.com/user/project.git
git fetch

The only difference is I am using git fetch instead of git remote update

Are there any drawback of the two commands? (from the complete backup point of view, e.g. backup all tags, branches)

like image 480
Howard Avatar asked Sep 16 '26 11:09

Howard


1 Answers

Basically, unless you setup a specific configuration, git remote updates runs a git fetch against all your remotes.

The man page states

update
Fetch updates for a named set of remotes in the repository as defined
by remotes.<group>. If a named group is not specified on the command 
line, the configuration parameter remotes.default will be used; if 
remotes.default is not defined, all remotes which do not have the 
configuration parameter remote.<name>.skipDefaultUpdate set to true 
will be updated. (See git-config[1]).

In your case, if you didn't define any remotes.<group> nor a remotes.default, and if your only remote is github, running git remote update or git fetch is completely equivalent.

like image 197
Arialdo Martini Avatar answered Sep 18 '26 06:09

Arialdo Martini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!