33

I use TortoiseGit 1.8.3. I changed one of the files: Makefile, but I want to not offer commit it to me every once in a Git Commit. I added it to the "delete and add to ignore list", but it does not help. How do I make to some of the files that I have changed is not offered in the commit?

I want, that Makefile was in remote repository as read-only, that I could edit it locally, and then TortoiseGit does not offer to me to commit it.

That I wanted for Git-bash: https://www.kernel.org/pub/software/scm/git/docs/git-update-index.html

Yue Lin Ho
  • 2,945
  • 26
  • 36
Alex
  • 12,578
  • 15
  • 99
  • 195

4 Answers4

71

Answer for TortoiseGit 1.8.15, Git 2.6.1. There is no need to revert to the command line, all functions are directly available in TortoiseGit. I've tried to summarize the various ways how this function is accessible. I assume that the reader knows what "assume unchanged" means. Here is easy documentation about this feature. Or the original documentation about --assume-unchanged or git ls-files.


Flag a file as "assume unchanged"

There are three possibilities in TortoiseGit: in the Commit dialog, the Working Tree dialog (Check for Modifications) or in the Log Messages dialog (only when Working dir changes entry is selected). From one of these dialogs do the following:

  • right-click the file and select the entry Assume Unchanged


From any file list in Windows Explorer do the following:

  • right-click the file and select properties
  • go to the Git tab
  • tick the entry Assume valid/unchanged

Remove the "assume unchanged" flag from a file (undo the above):

TortoiseGit allows to remove the flag only from the Working Tree dialog (check for Modifications).

  • in the lower left corner of the dialog: make sure to tick the option Show ignore local changeds flagged files
  • all files with assumed valid or skip worktree flag will be shown below the normal changed files
  • right-click on the file and select Unflag as skip-worktree or assume-unchanged


From any file list in Windows Explorer do the following:

  • right-click the file and select properties
  • go to the Git tab
  • untick the entry Assume valid/unchanged
user23573
  • 2,479
  • 1
  • 17
  • 36
34

If I'm interpreting the question correctly, Alex wants to know how to undo an --assumed-unchanged action done using Tortoise Git.

You don't need to use command line Git to fix this:

  1. Navigate to the file(s) you did this action on in windows explorer,
  2. Right-click and choose Properties,
  3. Select the Git tab, there you should see a checked box next to "Assume valid/unchanged".
  4. Uncheck it and it won't be ignored by commits moving forward.

enter image description here

Nam G VU
  • 33,193
  • 69
  • 233
  • 372
deaddancer
  • 544
  • 8
  • 16
8

The approved answer is good but in case you're hunting for the dialogues and options here you have a short help:

enter image description here enter image description here enter image description here

raisercostin
  • 8,777
  • 5
  • 67
  • 76
3

If it doesn't help, then you need to go to a command-line interface, and check:

I want, that Makefile was in remote repository in read-only, that I could edit it localy, and then TortoiseGIT does not offer to me to commit it.

This is different:

You need:

git update-index  --really-refresh --no-assume-unchanged Makefile

That will make any local modification to Makefile "invisible" to git, while keeping Makefile under source control.

If you want your local modifs to resist a git reset, do;

git update-index --skip-worktree Makefile
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I made .gitignore, added to it Makefile, and commited .gitignore. I delete Makefile by rm. And status shows me that: deleted: Makefiles. Then I try commit and TortoiseGit offers to me to commit it again. I commited and pushed, and Makefile was deleted from repository - but I don't want it. I want, that Makefile was in remote repository in read-only, that I could edit it localy, and then TortoiseGIT does not offer to me to commit it. – Alex May 28 '13 at 10:04
  • 1
    @Alex ok, I have edited my answer to address your specific need. – VonC May 28 '13 at 11:22
  • Thanks, it works! And I can do it from GUI TortoiseGIT->Commit->Right click on file->(Skip work tree) and (Assume unchanged). Else I can see skipped files by: git ls-files -t. I can undo "skip" by using: git update-index --no-skip-worktree. And undo assume by using: git update-index --really-refresh --assume-unchanged. But how can I undo it by using GUI TortoiseGIT? – Alex May 28 '13 at 15:29
  • @Alex not sure if the undo is supported by TortoiseGit. – VonC May 28 '13 at 15:37