How to discard unstaged changes in Git

+1 vote

Hi Guys,

I have unstaged changes in the Git repository. I want to discard the unstaged changes from the repository. How can I do that?

Dec 22, 2020 in Git & GitHub by akhtar
• 38,260 points
527 views

1 answer to this question.

0 votes

Hi@akhtar,

You can save the unstaged changes in the stash as shown below.

$ git stash save --keep-index --include-untracked

You don't need to include --include-untracked if you don't want to be thorough about it.

After that, you can drop that stash.

$ git stash drop
answered Dec 22, 2020 by MD
• 95,460 points

Related Questions In Git & GitHub

0 votes
1 answer

How to reset the changes in Git?

Hi@MD, Reset command can be used to undo ...READ MORE

answered Nov 20, 2020 in Git & GitHub by akhtar
• 38,260 points
719 views
0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,890 points
2,419 views
0 votes
1 answer

How to give a file execute mode permissions in Git?

You can easily do this in one ...READ MORE

answered Aug 7, 2018 in Git & GitHub by Sophie may
• 10,620 points
20,969 views
0 votes
1 answer

How to add a remote git repository in Jenkins

Follow these steps: Step 1 Go to Manage ...READ MORE

answered May 23, 2019 in Git & GitHub by Alok
13,534 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,940 views
+2 votes
1 answer
0 votes
1 answer

How to get changes from master branch to a new branch in Git?

Hi@akhtar, You need to check out the branch and ...READ MORE

answered Jan 4, 2021 in Git & GitHub by MD
• 95,460 points
1,091 views
0 votes
1 answer

How to roll back to previous version in Git?

Hi@akhtar, You can roll back your previous version ...READ MORE

answered Apr 29, 2020 in Git & GitHub by MD
• 95,460 points
1,002 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP