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文件