2.git status # On branch master nothing to commit (working directory clean) 说明已经没有新的改动了
本地操作 1.git pull remote: Counting objects: 254, done. remote: Compressing objects: 100% (206/206), done. remote: Total 206 (delta 20), reused 0 (delta 0) Receiving objects: 100% (206/206), 12.70 MiB | 76.00 KiB/s, done. Resolving deltas: 100% (20/20), completed with 20 local objects. From xxx:/www/web/xxxcom/ 51c91d8..fe6c6c6 master -> origin/master Updating 51c91d8..fe6c6c6 error: Your local changes to the following files would be overwritten by merge: public_html/data/config.inc.php public_html/data/tasks.inc.php Please, commit your changes or stash them before you can merge. Aborting
2.修改bug,然后git commit -am 'fix images not show in detail' [master 5aaf3a2] fix images not show in detail 4 files changed, 19 insertions(+), 4 deletions(-) 没错,是改了4个文件
3.git push To xxx:/www/web/xxxcom/.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'xxx:/www/web/xxxcom/.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. 失败了,猜想大概是因为本地git pull Abort的那2个文件
4.git push -f origin master 尝试性的这样提交。。然后就悲催了 Counting objects: 21, done. Delta compression using up to 4 threads. Compressing objects: 100% (10/10), done. Writing objects: 100% (10/10), 1.10 KiB | 0 bytes/s, done. Total 10 (delta 8), reused 0 (delta 0) remote: Push to checked out branch refs/heads/master remote: W:unstaged changes found in working copy remote: W:stashing dirty working copy - see git-stash(1) remote: Saved working directory and index state On (no branch): dirty working copy before update to 5aaf3a2ea32bb30cf367dcf713a2031dee00f75e remote: HEAD is now at fe6c6c6 update remote: trapped 9133 remote: Updating working copy remote: M public_html/app/goods.app.php remote: M public_html/app/shop.app.php remote: M public_html/app/cart.app.php remote: M public_html/data/config.inc.php remote: D public_html/data/files/store_44/goods_1/201404101820016058.jpg remote: D public_html/data/files/store_44/goods_10/201403301603305815.jpg *** remote: D 100多个文件 *** remote: HEAD is now at 5aaf3a2 fix images not show in detail To xxx:/www/web/xxxcom/.git + fe6c6c6...5aaf3a2 master -> master (forced update) 然后服务器上的remote: D的文件都删除了。。。 我想不明白,本地也没有删除啊,怎么就push会有呢?
5.git status On branch master Your branch is up-to-date with 'origin/master'.