Quantcast
Viewing latest article 6
Browse Latest Browse All 42

Answer by Pau for How do I discard unstaged changes in Git?

You could create your own alias which describes how to do it in a descriptive way.

I use the next alias to discard changes.


Discard changes in a (list of) file(s) in working tree

discard = checkout --

Then you can use it as next to discard all changes:

discard .

Or just a file:

discard filename

Otherwise, if you want to discard all changes and also the untracked files, I use a mix of checkout and clean:

Clean and discard changes and untracked files in working tree

cleanout = !git clean -df && git checkout -- .

So the use is simple as next:

cleanout

Now is available in the next Github repo which contains a lot of aliases:


Viewing latest article 6
Browse Latest Browse All 42

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>