Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rollback using repo command?

How can I do a rollback when I use the repo command?

I made some changes in some files and now I want to rollback to the source that was downloaded when I used the repo sync command.

I haven't committed the changes.

like image 745
Laser Avatar asked Jun 22 '12 08:06

Laser


People also ask

How do I revert changes to a local repository?

The `git restore ` is the easiest way to undo the local changes of the file in the repository. Like the last part, the send-email2. php file has been updated. Run the following commands to check the status of the git and undo the changes of the file by using the `git restore` command.

Can we revert the commit in git?

The git revert command is used for undoing changes to a repository's commit history. Other 'undo' commands like, git checkout and git reset , move the HEAD and branch ref pointers to a specified commit. Git revert also takes a specified commit, however, git revert does not move ref pointers to this commit.


2 Answers

Right commands is:

If you want to revert changes made to your working copy, do this:
repo forall -c "git checkout ."

If you want to revert changes made to the index (i.e., that you have added), do this:
repo forall -c "git reset"

If you want to revert a change that you have committed, do this:
repo forall -c "git revert ..."

like image 144
Laser Avatar answered Sep 19 '22 17:09

Laser


Use git reset then.

Repo is not meant to replace Git, only to make it easier to work with Git in the context of Android. via

According to the Repo command reference there is no equivalent of git reset command (yet?)

like image 44
shytikov Avatar answered Sep 19 '22 17:09

shytikov