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?
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
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