Christian Vincenzo Traina
Christian Vincenzo Traina

Reputation: 10384

Files have been removed from remote repository, but they didn't get removed in local repository

A teammate removed several files and then committed the changes, and actually checking the remote repository those files result as not existing.

Although, when I pulled the change, the files didn't get deleted in my local master, even if I didn't get any change and if I try to pull again it says that is everything up-to-date.

Here is my git status:

On branch master Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Tell me if I need to include further information, but I don't know what to add more.

I already tried to google the problem, but I didn't find anything relevant.

Thank you

Upvotes: 0

Views: 39

Answers (1)

CodeWizard
CodeWizard

Reputation: 142064

There can be several reasons for viewing file locally while they are not in the remote repository.

  1. .gitignore - This file tells git which patterns to ignore and not to manage
  2. assume-unchanged - tells git to ignore any local changes made on a given file

assume-unchanged

--[no-]assume-unchanged

When this flag is specified, the object names recorded for the paths are not updated.

Instead, this option sets/unsets the "assume unchanged" bit for the paths.

When the "assume unchanged" bit is on, the user promises not to change the file and allows Git to assume that the working tree file matches what is recorded in the index. If you want to change the working tree file, you need to unset the bit to tell Git. This is sometimes helpful when working with a big project on a filesystem that has very slow lstat(2) system call (e.g. cifs).

Git will fail (gracefully) in case it needs to modify this file in the index e.g. when merging in a commit; thus, in case the assumed-untracked file is changed upstream, you will need to handle the situation manually.

enter image description here

Upvotes: 1

Related Questions