Error: Cannot pull with rebase: You have unstaged changes

前端 未结 9 1766
无人共我
无人共我 2020-12-07 07:33

I have started collaborating with a few friends on a project & they use the heroku git repository.

I cloned the repository a few days ago and they have since mad

相关标签:
9条回答
  • 2020-12-07 08:30

    If you want to keep your working changes while performing a rebase, you can use --autostash. From the documentation:

    Before starting rebase, stash local modifications away (see git-stash[1]) if needed, and apply the stash when done.

    For example:

    git pull --rebase --autostash
    
    0 讨论(0)
  • 2020-12-07 08:30

    Pulling with rebase is a good practice in general.

    However you cannot do that if your index is not clean, i.e. you have made changes that have not been committed.

    You can do this to work around, assuming you want to keep your changes:

    1. stash your changes with: git stash
    2. pull from master with rebase
    3. reapply the changes you stashed in (1) with: git stash apply stash@{0} or the simpler git stash pop
    0 讨论(0)
  • 2020-12-07 08:32

    If you want to automatically stash your changes and unstash them for every rebase, you can do this:

    git config --global rebase.autoStash true
    
    0 讨论(0)
提交回复
热议问题