gitsvnversion-controlchangelist

Git - Change List (svn) Equivalent


We used svn for years, and have recently switched over to Git. We used to use change lists in svn for a specific purpose. They are similar to global ignores but not exactly the same. A global ignore tells svn not to add files that fit the pattern, but if a file is already added to version control, the ignore won't do anything. This is the same thing in Git. Git ignore files tell Git to ignore files that match a given pattern, but only if they have not yet been added to version control.

Change lists in svn allowed us to specify files that had already been added in to version control. Once the files had been added to the change list, svn would ignore these files on commit. The basic advantage of this is that you can freely edit certain files without the fear of accidentally commiting a change that you don't want to go in to the main code base. A good example scenario is when you want to work with a specific customer's configuration and add customer specific references to your project files that should not exist in the core code base.

Git has the concept of stashes which is different again. We can store deltas in a stash in a local repo. These can be freely applied, pushed, or popped which solves one part of the problem. However, when we do a commit (through some gui tool - tortoise git, gitkraken, VS), these files will still show up in the list of files that Git wants to commit. I don't want them to show up because I will more than likely make a mistake and commit them accidentally.

Is there some way to achieve change list like functionality in Git?

Note: I really don't want to have to do this through the command line. I use a combination of Visual Studio, Git Kraken, and Tortoise Git. I like the Gui system. I don't want to have to run a command at the command prompt which will automatically commit my changes while avoiding the files I specify.


Solution

  • The article in the answer that @Marina - MSFT posted led me to the answer: https://www.visualstudio.com/en-us/docs/git/tutorial/ignore-files

    This stops tracking files already committed in Git:

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

    The resumes tracking of files already committed in Git:

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

    I didn't want to have to run things at the command line so I made a batch file which stops tracking all the files I want to ignore. I just double click on it when I need it. Git no longer pays attention to these files. It works exactly the same was a change lists in svn.