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,240 points
184 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,380 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,240 points
290 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
1,637 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,590 points
17,012 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
8,298 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
2,073 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,380 points
501 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,380 points
427 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