GIT
2024-02-26 17:08:29 0 举报
AI智能生成
git命令
作者其他创作
大纲/内容
4. 分支管理
创建分支
git branch 分支
git checkout -b 分支名
git checkout -b X origin/X
创建远程分支
切换分支
git checkout 分支名
查看分支
git branch -a
删除分支
git branch -D 分支名
删除未合并的分支
git branch -d 分支名
删除已经合并的分支
关联远程分支
git branch --set-upstream X origin/X
合并分支
git merge
更新远程库信息
git fetch
更新分支
git pull
推送分支
git push
git push origin 分支名
查看远程仓库
git remote
git remote -v
5.暂存区
暂存未提交内容
git stash
恢复暂存内容
git stash apply
仅恢复
git stash pop
先恢复,后删除
删除暂存内容
git stash drop
6.标签
查看标签
git tag
git tag -r
添加tag
git tag 标签名
git tag 标签名 commitId
删除tag
git tag -d 标签名
git push origin -d 标签名
推送tag
git push origin 标签名
git push origin --tags
更新到本地
git pull origin --tags
0.配置
git config --global user.name "name"
git config --global user.email "email"
git config user.name "name"
git config user.email "email"
1.创建
git init
git clone(推荐)
2.提交
提交文件
git commit
填写message
保存
git commit -m "message"
查看状态
git status
git diff
git log
git log --pretty=oneline
git reflog
回退
git reset --hard commitId
git reset HEAD 文件
将暂存区的文件撤销到工作区
3.文件管理
2.添加文件
git add 指定文件
git add .
.gitignore中指定的文件被忽略
6.删除文件
git rm 文件名
git rm --cached 文件名
删除版本库,不删除本地文件
7.重命名
git mv
0 条评论
下一页