Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

I have a bunch of files in a changeset, but I want to specifically ignore a single modified file. Looks like this after git status:

# modified:   main/dontcheckmein.txt

# deleted:    main/plzcheckmein.c

# deleted:    main/plzcheckmein2.c

Is there a way I can do git add but just ignore the one text file I don't want to touch? Something like:

git add -u -except main/dontcheckmein.txt

1 Answer

0 votes
by (50.2k points)

You can do git add and also you can ignore the file by using the following commands 

git add -u

git reset -- main/dontcheckmein.txt

Here main/dontchekmein.txt is the file that you have mentioned in the question.

Refer: https://git-scm.com/docs/git-reset#Documentation/git-reset.txt-Resetasinglefileintheindex

Related questions

0 votes
1 answer
+15 votes
1 answer
+12 votes
2 answers

Browse Categories

...