Git remote show origin the origin indicates the root directory of your project.
$ git remote show origin* remote origin Fetch URL: git@gitlab.alibaba-inc.com:middleware/jingwei.git Push URL: git@gitlab.alibaba-inc.com:middleware/jingwei.git HEAD branch: master Remote branches: br-2.1.2.1 tracked br-2.1.2.2 tracked br-2.1.3 tracked master tracked Local branches configured for 'git pull': br-2.1.2.2 merges with remote br-2.1.2.2 master merges with remote master Local refs configured for 'git push': br-2.1.2.2 pushes to br-2.1.2.2 (local out of date) master pushes to master (up to date)shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei/jingwei-webconsole (master)$ git remote showorigin
2 Remote branch br-2.1.2.1 pull down, found to overwrite the current branch, want to roll back to the previous Modification
Shuohailhl @ SHUOHAILHL-PC/f/ggg/Jingwei (master); the current branch is the master, in fact, want to capture the code of the br-2.1.2.1 local, executing git pull is equivalent to the effect of git fetch and git merge, capturing remote br-2.1.2.1 locally and merging it with the current version. (Do you have to take the br-2.1.2.1 down ?)
$ git pull origin br-2.1.2.1From gitlab.alibaba-inc.com:middleware/jingwei * branch br-2.1.2.1 -> FETCH_HEADAuto-merging pom.xmlCONFLICT (content): Merge conflict in pom.xmlAuto-merging jingwei-webconsole/pom.xmlCONFLICT (content): Merge conflict in jingwei-webconsole/pom.xmlAuto-merging jingwei-monitor/pom.xmlCONFLICT (content): Merge conflict in jingwei-monitor/pom.xmlAuto-merging jingwei-core/src/main/java/com/taobao/jingwei/core/kernel/AbstractJingWeiCore.javaCONFLICT (content): Merge conflict in jingwei-core/src/main/java/com/taobao/jingwei/core/kernel/AbstractJingWeiCore.javaAuto-merging jingwei-core/pom.xmlAutomatic merge failed; fix conflicts and then commit the result.
After executing the pull origin command, the version you want to capture is not captured.
shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (master)$ git pull origin br-2.1.2.1From gitlab.alibaba-inc.com:middleware/jingwei * branch br-2.1.2.1 -> FETCH_HEADAuto-merging pom.xmlCONFLICT (content): Merge conflict in pom.xmlAuto-merging jingwei-webconsole/pom.xmlCONFLICT (content): Merge conflict in jingwei-webconsole/pom.xmlAuto-merging jingwei-monitor/pom.xmlCONFLICT (content): Merge conflict in jingwei-monitor/pom.xmlAuto-merging jingwei-core/src/main/java/com/taobao/jingwei/core/kernel/AbstractJingWeiCore.javaCONFLICT (content): Merge conflict in jingwei-core/src/main/java/com/taobao/jingwei/core/kernel/AbstractJingWeiCore.javaAuto-merging jingwei-core/pom.xmlAutomatic merge failed; fix conflicts and then commit the result.shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (master|MERGING)$ git br br-2.1.2.2* master
(1) Use the GIT reset -- hard head command to undo this pull origin operation and restore it to the last modification.
shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (master|MERGING)$ git reset --hard HEADHEAD is now at 89700a3 optimize upload fileshuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (master)$ git status# On branch masternothing to commit, working directory clean
(2) Use git reset -- hard head ^
shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (master|MERGING)$ git reset --hard HEAD^HEAD is now at f6423ad modify groupshuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (master)$ git status# On branch master# Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.#nothing to commit, working directory clean
Pull again
$ git pullUpdating f6423ad..89700a3Fast-forward .../webconsole/biz/exception/TimeoutException.java | 29 +++++++++ .../webconsole/util/upload/UploadFileImpl.java | 46 ++++++++++++++ .../webconsole/util/upload/UploadFileService.java | 19 ++++-- .../web/filter/JingweiSecurityFilter.java | 74 +++++++++++++++------- .../webconsole/web/filter/UploadFileFilter.java | 29 +++++++++ .../web/module/screen/api/JingweiGateWay.java | 8 ++- .../screen/api/cmd/GetConsoleTarTimeCommand.java | 61 ++++++++++++++++++ 7 files changed, 238 insertions(+), 28 deletions(-) create mode 100644 jingwei-webconsole/src/main/java/com/taobao/jingwei/webconsole/biz/exception/TimeoutException.java create mode 100644 jingwei-webconsole/src/main/java/com/taobao/jingwei/webconsole/web/module/screen/api/cmd/GetConsoleTarTimeCommand.javashuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (master)$ git status# On branch masternothing to commit, working directory clean
Check the GIT log and find that "Modify group" was modified earlier than "optimize Upload File. Note: "head" indicates the last modification submitted. "Head ^" indicates the latest modification submitted by second.
The first seven digits are exactly the first seven digits of a large string.
commit 89700a31c005001d34256761dd4c945c6c70a06
commit f6423ad5ca231e00e44626a2dcb8ba300c7a5fe
Updating f6423ad..89700a3
Updating indicates that the local working directory is changed from one version (f6423ad) to another version (89700a3 ).
$ git logcommit 89700a31c005001d34256761dd4c945c6c70a06Author: shuohai.lhl <shuohai.lhl@taobao.com>Date: Sat Aug 3 19:54:46 2013 +0800 optimize upload filecommit f6423ad5ca231e00e44626a2dcb8ba300c7a5feAuthor: shuohai.lhl <shuohai.lhl@taobao.com>Date: Mon Jul 29 10:42:37 2013 +0800 modify groupcommit aa4ae6f4f447471d15038b73cb4d5c52b2eb623Author: shuohai.lhl <shuohai.lhl@taobao.com>Date: Fri Jul 26 10:25:06 2013 +0800 revertcommit ba1b6e5e997e866f013cda0feaa043115623d7fAuthor: shuohai.lhl <shuohai.lhl@taobao.com>Date: Fri Jul 26 09:05:37 2013 +0800 rightcommit ceec1780e44570e6c311ec7d1db86a0f17e268cAuthor: shuohai.lhl <shuohai.lhl@taobao.com>Date: Fri Jul 26 09:00:29 2013 +0800 rightcommit 2f4ce1c1d31be5ffa1d2e79baa98979c36ae99cAuthor: shuohai.lhl <shuohai.lhl@taobao.com>Date: Sun Jul 21 18:26:12 2013 +0800 fix zk config must match stat config.