https://git-scm.com/download(本人下載Git-2.10.0-64-bit.exe)git
安裝完成後,鼠標右鍵能看相關欄目github
1)start a projectweb
2)create a new repositorybash
3)獲取repository地址ide
注意:fetch
1)在工程所在目錄,鼠標右擊選中「git bash here」ui
2)git init:生成.git文件夾idea
命令完成後會生成.git文件夾spa
3)git上傳時忽略某些文件和文件夾code
進入.git/info目錄,修改exclude
# git ls-files --others --exclude-from=.git/info/exclude # Lines that start with '#' are comments. # For a project mostly in C, the following would be a good set of # exclude patterns (uncomment them if you want to use them): # *.[oa] # *~ .idea target *.iml
4)git add -A:添加全部內容爲待commit
5)git commit -m "demo首次提交":工程提交,-m 表示本次提交的註釋說明
6)git remote add github-demo https://github.com/BAN-WANG/demo.git:建立遠程倉庫,其中github-demo爲倉庫名。
7)git push -u github-demo master:上傳至遠程倉庫github-demo的master分支上
8)git status:能夠查詢倉庫狀態。
1)修改demo-web下pom.xml,本地將version改成:1.0.1-SNAPSHOT
<artifactId>demo-web</artifactId> <version>1.0.1-SNAPSHOT</version> <packaging>war</packaging>
使用git status命令:看到pom.xml修改了
本地commit:git commit demo-web/pom.xml -m "demo-web變動版本1.0.1-SNAPSHOT"
2)github修改成:1.0.2-SNAPSHOT
3)git push 時衝突發生:
4)使用git pull:(git fetch區別在於pull會merge)
5)修改衝突文件
<artifactId>demo-web</artifactId> <<<<<<< HEAD <version>1.0.1-SNAPSHOT</version> ======= <version>1.0.2-SNAPSHOT</version> >>>>>>> f5091a89a3b5b2ee520f7a2051b40d26870baafc <packaging>war</packaging>
改成
<artifactId>demo-web</artifactId> <version>1.0.3-SNAPSHOT</version> <packaging>war</packaging>
6)從新commit並push
7)查詢github文件