1

I have a templates directory with around 10 *.html files. I made changes to most of them. Now i want to revert changes only in the index.html file. How can i do that:

if i have committed my latest changes? if i have not committed my latest changes? (i dont want to git reset --HARD which will undo all the changes)

2 Answers 2

4

Try

git checkout -- index.html

for when you haven't committed yet.

If you have committed you need to git reset [--mixed] the last commit, do the git checkout and git commit again.

1

If you haven't committed:

git checkout index.html

If you have committed, use git log to find the commit id you wish to revert, such as 3a765c6cd6316a665cca789d11a7186234c203a8 and type:

git checkout 3a765c6cd6316a665cca789d11a7186234c203a8 -- index.html

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.