Prevent local changes getting pushed in Git

前端 未结 4 1532
灰色年华
灰色年华 2020-12-04 07:06

I have cloned a repository and the master branch in my repo is tracking origin/master. I created a work branch and changed some config

4条回答
  •  一向
    一向 (楼主)
    2020-12-04 07:49

    What you need is a .gitignore file and add all your config file inside the .gitignore file.

    Once your .gitignore file is ready you might need to removed your config files from the Cache

    Here's the command:

    (Assume you use linux)
    vi .gitignore
    //Add all your config file inside
    
    //run the following command to remove your config file from GIT cache if your config files is already track by GIT
    
    git rm --cached myconfig.php
    

提交回复
热议问题