Git ignore specified file submitted

Git ignore specified file submitted

  We often use in the project development process git to manage their own projects, using git version control for multiplayer collaborative development has many advantages here is not elaborated, interested students can go to find information systematic study . And to say that this article is a problem encountered during use git, that is, we often modify some configuration files in the project development process, but sometimes these profiles need not be submitted to a remote repository, only local effect can be, then you need every time we submit code to the file manually to ignore, so the file could take the set into a permanent ignore it? the answer is definitely yes, git of gitignore file can add files, the file added to it will not be detected and submitted to a remote git repository.

  But when the project is to add files into .gitignore sometimes does not take effect, modify the file and git .gitignore found did not work then push up, this is because before this document was submitted detected, for already track the file does not work, the solution is: the previous track of files to removed, re-track. At this point there are two solutions:

1: Use

git rm -r --cached. Delete all cache files

git add. re-add all files

git commit -m "update .gitignore" submit this revision

  This situation is to edit multiple files, but this operation may cause the code on the code on your master branch and the main branch of conflict (the code will be exactly the same conflict, my personal experience ) is not recommended

2: Use the specified file git rm --cached conf / config.php delete cache, in which case the status git will display the file has been deleted, but still has not changed its local file, submitted push this revision, this when the branch will merge the time to delete the files submitted as modified up, you need to manually resolve the conflict, otherwise it will delete the file on the master main branch, to end here, after operations on the file will not git is detected.

               

------- 2019 Tanabata festival, the sky is blue today, I wish you all happy Tanabata

Guess you like

Origin www.cnblogs.com/qqayy/p/11317087.html