Ignore changes to a tracked file

后端 未结 2 1723
名媛妹妹
名媛妹妹 2020-12-01 17:00

I want to change a tracked file for development only, but keep the tracked version unchanged.

Most \"solutions\" for this suggest

git update-index --         


        
2条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 17:50

    Since in one of your comments you are working directly in the master branch, the real problem to fix is working in master.

    You'll want to create a Topic Branch in Git:

    git checkout -b some_feature_or_bug_fix master
    

    Then make the necessary changes to the config file, and commit as normal.

    The nice thing here is you don't affect files in master. If you need to pull in updated code, just git fetch and git merge origin/master into your topic branch. Then you can deal with upstream changes to the config file as normal Git merges.

    Prior to merging your topic branch into master you can do an interactive squash to reduce your commits and merge commits into one nice, clean commit. Or do a git merge --squash to merge your topic branch into master.

提交回复
热议问题