2

There are numerous questions about this argument BUT none of them was useful in my case.

I've pushed my local project to a bitbucket repository, including a config.php file. Now I've changed my local copy of the config.php file and I need to keep it different from the bitbucket copy.

I updated my gitignore file but it didn't help because the config.php file was already tracked.

So:

I need to ignore the local config.php file BUT I DO NOT WANT TO DELETE the bitbucket config.php file.

Command line solutions are of course welcomed.

P.s. Sub-question:

In SourceTree if you (right click)"stop tracking" an unstaged file, the software stages the remote deletion of that file. But if then you right click on the staged deletion record (before any commit/push), there are 2 choices: "Stop Tracking" and "Unstage from index". What is the meaning of those 2 options? Why allow to "stop tracking" for 2 times?

GolezTrol
  • 114,394
  • 18
  • 182
  • 210
Igor Carmagna
  • 957
  • 1
  • 10
  • 34

1 Answers1

3

In the git prompt (which you can also start from SourceTree), you can use the command:

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

Source: Pagebakers: GIT: ignoring changes in tracked files

GolezTrol
  • 114,394
  • 18
  • 182
  • 210
  • Thanks!! Is this the meaning of the SourceTree right-click option "Unstage from index"? If not what does "Unstage from index" mean? – Igor Carmagna Jan 08 '15 at 19:15
  • No, when staging, you say which files (or chunks of files) you want to commit during your next commit. Unstage removes a file from stage, so it won't be committed next time, but this is a one time operation, and you will have to pay attention each time so you don't accidentally commit the file. – GolezTrol Jan 08 '15 at 19:17
  • 1
    The description 'Unstage from index' is a bit unclear. It could just be 'Unstage'. There is an open [issue report for that](https://jira.atlassian.com/browse/SRCTREEWIN-524). – GolezTrol Jan 08 '15 at 19:19
  • Perfect... very clear!! I'll try your solution right now – Igor Carmagna Jan 08 '15 at 19:23