How to not delete untracked files from git when pulling
My friend and I are working on a git repository. Actually i made a mistake by setting all files on stage before adding .gitignore file, and i pushed all on github, my friend have clonned the project as well.
Now to solve the problem, i have manually untracked those files with
git rm --cached <files> , and i did a seconde push, to get those files removed from github.
- Github how to give authorization to my repository to other people
- git/ftp workflow logic
- Does Github store all commits made to the repo for the life of that repo?
- How to handle your first Pull Request on GitHub?
- How do I code against one github repo on 2 computers?
- Forking a GitHub repo using from the command line with bash, cURL, and the GitHub API
But the problem here is when my friend try to get my last update on github, the
pull command deletes all those files that i have untracked from his local repository.
Is there a way to tell git to not delete those files that i have untracked, when my friend try to
pull the latest version of the project ?
The only solution that i have in mind for now, is to tell my friend to manually untrack those files, just like i did.
One Solution collect form web for “How to not delete untracked files from git when pulling”
Have them mixed-reset to your commit:
git fetch origin git reset origin/master
This will update their branch to reflect your removal commit, but not change the files in the working directory.