Because sometimes there is no Internet connection locally, and then after accidentally submitting the new file code to github, the files seem to be marked as submitted the next time they are submitted (actually they are not submitted), and then the github and local codes are not Sync
迷茫2017-05-02 09:35:16
No way.
My steps are usually like thisgit push
git push
如果失败的话,说明网络上的版本已经更改过了,那就git pull
如果失败的话,说明网络的版本和本地的版本在合并时可能产生冲突,那就git stash
(把本地的修改全部缓存起来)
然后再git pull
然后再git stash pop
(把缓存起来的修改恢复)
然后如果有冲突解决冲突,没有就git push
If it fails, it means that the version on the network has been changed, then
git pull
If it fails, it means The network version and the local version may conflict when merging, then
git stash
(cache all local changes)🎜and then 🎜git pull
🎜then Then 🎜git stash pop
(restore the cached changes)🎜Then if there is a conflict, resolve the conflict, if not, just 🎜git push
🎜
🎜Use Turtle’s Git tool under Windows. 🎜PHP中文网2017-05-02 09:35:16
= = Is the submission you are talking about a commit?
If it is a commit, there is no problem, because the commit is to submit the code to the local warehouse
For example, when you don’t have internet
//改了一些文件
git commit -am 'fix a bug'
//又改了一些文件
git commit -am 'add new func'
These changes are all submitted to the local repository, but the remote repository remains unchanged
wait until you have internet access
git push
At this time, the remote warehouse will be compared with your local warehouse, and then the changes will be pushed to the remote warehouse.
The remote warehouse will also have these two commit records at this time.
'fix a bug'
'add new func'
Recommend you to read git tutorial
黄舟2017-05-02 09:35:16
When there is no network, it is submitted to its own local library. If you submit to the remote library, you need to git push
高洛峰2017-05-02 09:35:16
If you are very sure that it is not because someone else updated that your request cannot be completed, but because the last submission caused a problem with the remote version library due to network reasons (unlikely), and you are very sure that the local library is No problem, you can:
git push origin master:master --force
PHPz2017-05-02 09:35:16
I think so, git and github are two different concepts. I understand that you submitted it to the local version control management without an Internet connection, but did not push to the version control of the remote server. Git is distributed version control, that is, a complete version library is maintained remotely and locally. If you connect to the Internet to pull the code, you will pull the code from the server and merge it into the local branch. If you use fetch, you need to check whether you have merge remote branches.
天蓬老师2017-05-02 09:35:16
First of all, let’s distinguish what is Git and what is Github.
Then, the Git commit will not be pushed to the remote library. Could it be that you used SVN before?