初始化git仓库
// 进入需要初始化git仓库的地方
git init
// 成功后会发现当前目录下多了一个.git 文件
// 该目录是隐藏的,使用
ls -ah //可以查看隐藏文件
添加文件
// 添加全部
git add .
// 添加单个文件,需要带文件扩展名的,比如readme.txt
git add file
// 添加多个文件
git add file1 file2
查看状态
git status
提交文件
git commit -m 'commit message'
提交文件到远程仓库
git push
更新远程仓库代码
git pull
查看分支
git branch
创建分支
git branch branchName
提交分支到远程仓库
git push origin branchName
切换分支
git checkout branchName
新建分支并切换到新建的分支
git checkout -b newBranchName
删除本地分支
git branch -d branchName
删除远程分支
git push origin --delete branchName
暂存
git stash
应用暂存
git stash apply
git stash 相关的https://www.cnblogs.com/tocy/p/git-stash-reference.html
本文目的仅仅是为了个人查找阅读等提供方便
网友评论