-
初始化git项目
-
本地创建README.md
Linux:
touch README.md
Windows:
直接右键创建
-
创建.gitignore
Linux:
touch .gitignore
Windows
直接右键创建
-
*.class
-
-
#package file
-
*.war
-
*.ear
-
-
#kdiff3 ignore
-
*.orig
-
-
#maven ignore
-
target/
-
-
#idea ignore
-
.idea/
-
/idea/
-
*.ipr
-
*.iml
-
*.iws
-
-
-
# temp file
-
*.log
-
*.cache
-
*.diff
-
*.patch
-
*.tmp
-
-
# system ignore
-
.DS_Store
-
Thumbs.db
-
-
执行git init
输入git status查看情况
-
执行git add .
添加文件
输入git status查看情况
-
提交到本地git
Linux
git commit -am '注释 '
Windows
注释要用双引号
-
提交到远程仓库
git remote add origin +git地址
-
查看分支
git branch
-
推送
git push -u origin master
-
查看远程分支
git branch -r
-
创建分支
git checkout -b v1.0(分支名) origin/master
-
推送分支
git push origin HEAD -u
修改远程仓库地址
git remote origin set-url [url]
先删后加
git remote rm origin
git remote add origin [url]
切换分支
git checkout 分支名
删除远程分支
git push origin --delete [branchname]