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,280 points
23 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,330 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,280 points
31 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,330 points
84 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

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

The ‘git log’ command is your closest ...READ MORE

answered Jul 4, 2018 in Git & GitHub by Sophie may
• 9,330 points
44 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.