Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the usage for "repo sync -d" in Android source repository

from repo 's help, I found following information:

The -d/--detach option can be used to switch specified projects back to the manifest revision. This option is especially helpful if the project is currently on a topic branch, but the manifest revision is temporarily needed.

1 Can someone tell me what the situation to use the -d option?

2 Does it means I can get a working repo exactly the same as remote repository, no matter what topic you are working on.

like image 752
Gavin Avatar asked Jul 12 '12 09:07

Gavin


1 Answers

'repo sync -d' will move the HEAD of the repositories back to those specified in the manifest file. However, any staged or working directory changes will be retained.

If you have mucked up your working directory and need to get it back in order I would do this:

repo sync -d
repo forall -c 'git reset --hard'    # Remove all working directory (and staged) changes.
repo forall -c 'git clean -f -d'     # Clean untracked files

This will create a pristine working folder.

like image 189
OwainD Avatar answered Sep 30 '22 03:09

OwainD