How to forcefully commit a file to Git even if the file is ruled as unchanged?

0 votes
Let’s say I have two files with similar size and same creation date but different content and if I try to replace one file with the other, git does not recognize this file as changed

How can I solve this?
Jul 11, 2018 in Git & GitHub by Tyrion anex
• 8,270 points
41 views

1 answer to this question.

0 votes

This is simple, just follow the below commands:

git rm --cached <yourfile>

git add <yourfile>

This should add the new file into the index regardless of what was there previously.

answered Jul 11, 2018 by Sophie may
• 9,850 points

Related Questions In Git & GitHub

0 votes
1 answer

How to solve the ‘Git commit -a error’?

This happens when no editor is set. ...READ MORE

answered Jul 5, 2018 in Git & GitHub by Tyrion anex
• 8,270 points
64 views
0 votes
1 answer
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 6, 2018 in Git & GitHub by Sophie may
• 9,850 points
210 views
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
180 views
0 votes
1 answer
0 votes
2 answers

How to view the nested workflow of a local git repository?

The closest way to view branches in ...READ MORE

answered Aug 2 in Git & GitHub by Sirajul
• 30,540 points
77 views
0 votes
1 answer