search

Home  >  Q&A  >  body text

After git pull, the newly updated local files are deleted

There are 4 files in the remote warehouse and 5 files in the local warehouse, which is equivalent to adding one new file. After git pulling it from the remote warehouse, the new local files will be deleted. Direct git push will prompt that the version is behind. Can't push to remote warehouse, what should I do?

淡淡烟草味淡淡烟草味2811 days ago835

reply all(2)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:41:13

    Commit the newly added local files first and then merge the remote repository. The specific operations are as follows:
    git add .
    git commit -m "something"
    git fetch
    git rebase -i origin/remote branch name
    You can use rebase Prevent split ends

    reply
    0
  • PHPz

    PHPz2017-05-02 09:41:13

    Just to add. If it is not the final version submitted yet, there are two options at the git commit step.

    One is to stash first and then rebase git stash apply stash@{0}
    也可以先commit,然后完成了所有本地更改之后再git commit --amend

    reply
    0
  • Cancelreply