Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to discard changes using repo

Tags:

reset

repo

repo status shows me a lot of un-wanted changes.

It would be duplicated if I enter every project and use git reset --hard.

Is there a way to reset all the changes using repo, something like repo reset --hard?

like image 964
Johnny Avatar asked Feb 16 '11 03:02

Johnny


People also ask

How do I discard changes in git?

There are two Git commands a developer must use in order to discard all local changes in Git, remove all uncommited changes and revert their Git working tree back to the state it was in when the last commit took place. The commands to discard all local changes in Git are: git reset –hard. git clean -fxd.

How do I revert changes to a local repository?

Undo local changes by using git revert: Run the following command to check the current status of the repository. Run the following command to add the index. html file into the repository. Commit the task with the commit message and undo this change using the `git revert` command.

How do I delete uncommitted changes in git?

Try Git checkout --<file> to discard uncommitted changes to a file. Git reset --hard is for when you want to discard all uncommitted changes. Use Git reset --hard <commit id> to point the repo to a previous commit.


1 Answers

This is the command I use for this kind of things, very useful

repo forall -vc "git reset --hard" 

What everything mean here ?

the repo forall will execute for all repos.

the -v is verbose, so it will print the output of the command

the -c "COMMAND TO EXECUTE" is the actual command you want

like image 67
stdcall Avatar answered Nov 01 '22 15:11

stdcall