How do I tell git to ignore my local changes, but leave the file in my remote repo?

drewwyatt

Constantly changing my web.config file when testing/pushing to production gets old, so does having to remember to remove that from my staged changes when I don't change the file.

I have tried using selecting the "stop tracking" option in Sourcetree (which I think adds the file to my GitIgnore), but that looks like it will remove the file from my remote repo.

Is it possible to leave a file in my remote repo, and stop tracking local changes?

Lucas Trzesniewski

Use the following command:

git update-index --assume-unchanged <filename>

If you want to undo it later, use:

git update-index --no-assume-unchanged <filename>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How do I ignore an error on 'git pull' about my local changes would be overwritten by merge?

From Java

How do I make Git ignore file mode (chmod) changes?

From Java

How do I merge my local uncommitted changes into another Git branch?

From Dev

How do I get IntelliJ to see my remote git branches

From Dev

Git. Rebase local branch atop local master. How do I ignore a single files changes?

From Dev

How can I get the git repo on my server to automatically sync with changes to the github repo?

From Dev

Why does Git show my local "pull from remote" when I push my commit to the remote repo?

From Dev

How do I update my local repo without losing my already committed changes?

From Dev

Git ignore local file changes

From Dev

How do I tell fugitive my path to Git on Windows?

From Dev

How can I build my local git repo on external server?

From Dev

How do I get git to ignore my csv files?

From Dev

Git - How can I ignore a file of my repo without removing it from the repository?

From Dev

How do I reach a git repo on my home network?

From Dev

How to tell if github repo ahead of my local git cloned repo

From Dev

How do I forcibly ovewrite a local repo with changes from a remote repo while still preserving history?

From Dev

How do I make git fetch ignore my private key?

From Dev

Can I add a file to my local Git repo but not push it to remote

From Dev

How do I ignore everything in my repo except a few files?

From Dev

I want to add remote branch of my local repo?

From Dev

Git - how do I freeze a particular version of a small file, keep it in my repository, but then ignore constant minor changes to it going forward

From Dev

reassign an existing remote repo to my local repo

From Dev

How to tell git that my local directory is a specific directory in the remote tree

From Dev

Git - How can I ignore a file of my repo without removing it from the repository?

From Dev

How to tell if github repo ahead of my local git cloned repo

From Dev

How do I forcibly ovewrite a local repo with changes from a remote repo while still preserving history?

From Dev

unable to push my local git repo to the remote repo

From Dev

How to apply changes of a specific file of the other git repository to my own repo

From Dev

How can I check the changes between my local GIT repository and the remote one?

Related Related

  1. 1

    How do I ignore an error on 'git pull' about my local changes would be overwritten by merge?

  2. 2

    How do I make Git ignore file mode (chmod) changes?

  3. 3

    How do I merge my local uncommitted changes into another Git branch?

  4. 4

    How do I get IntelliJ to see my remote git branches

  5. 5

    Git. Rebase local branch atop local master. How do I ignore a single files changes?

  6. 6

    How can I get the git repo on my server to automatically sync with changes to the github repo?

  7. 7

    Why does Git show my local "pull from remote" when I push my commit to the remote repo?

  8. 8

    How do I update my local repo without losing my already committed changes?

  9. 9

    Git ignore local file changes

  10. 10

    How do I tell fugitive my path to Git on Windows?

  11. 11

    How can I build my local git repo on external server?

  12. 12

    How do I get git to ignore my csv files?

  13. 13

    Git - How can I ignore a file of my repo without removing it from the repository?

  14. 14

    How do I reach a git repo on my home network?

  15. 15

    How to tell if github repo ahead of my local git cloned repo

  16. 16

    How do I forcibly ovewrite a local repo with changes from a remote repo while still preserving history?

  17. 17

    How do I make git fetch ignore my private key?

  18. 18

    Can I add a file to my local Git repo but not push it to remote

  19. 19

    How do I ignore everything in my repo except a few files?

  20. 20

    I want to add remote branch of my local repo?

  21. 21

    Git - how do I freeze a particular version of a small file, keep it in my repository, but then ignore constant minor changes to it going forward

  22. 22

    reassign an existing remote repo to my local repo

  23. 23

    How to tell git that my local directory is a specific directory in the remote tree

  24. 24

    Git - How can I ignore a file of my repo without removing it from the repository?

  25. 25

    How to tell if github repo ahead of my local git cloned repo

  26. 26

    How do I forcibly ovewrite a local repo with changes from a remote repo while still preserving history?

  27. 27

    unable to push my local git repo to the remote repo

  28. 28

    How to apply changes of a specific file of the other git repository to my own repo

  29. 29

    How can I check the changes between my local GIT repository and the remote one?

HotTag

Archive