Track files in local Git repo but ignore in remote

前端 未结 3 2014
生来不讨喜
生来不讨喜 2020-12-11 15:33

Is it possible to track folders and files in a local repo but not on a remote so that when you push changes, they don\'t get pushed remotely? The reason being is that I\'m u

3条回答
  •  误落风尘
    2020-12-11 15:49

    You should create a local branch in addition to the branch that is synced with the remote repository. Having a local branch can be made by....

    git branch mybranch
    

    Then you can go between the branches by using the checkout function

    git checkout mybranch //now in local branch
    
    git checkout repobranch //now in repository branch
    

    WARNING Make sure when you push, you only push the changes in your repobranch. You don't want to have the changes you've made in the local branch to start appearing in your remote repository

提交回复
热议问题