您的位置:首页 > 财经 > 金融 > git常用命令

git常用命令

2024/7/6 19:38:54 来源:https://blog.csdn.net/u013668719/article/details/139495757  浏览:    关键词:git常用命令

git init – 初始化一个仓库
git add file – 添加一个或所有文件到仓库
git commit -m desc – 提交修改
git status – 查看仓库状态
git diff file – 查看文件修改内容
git log – 查看文件修改历史
git reset --hard head – 回退到某个版本
git reflog – 查看命令历史
git checkout – file – 撤销对文件的修改,返回到上一次commit时的状态
git rm file – 从版本库中删除某个文件
git switch -c branch name – 创建并切换分支
git switch branch name – 切换分支
git merge branch name – 合并分支
git branch -d branch name – 删除分支
git stash – 暂存工作区
git stash list – 查看暂存的工作区列表
git stash apply – 恢复暂存的工作区
git stash drop – 删除暂存的工作区
git stash pop – 恢复暂存的工作区,并删除
git cherry-pick – 复制一个特定的提交到当前分支
git push -u origin master – 将本地仓库推送到远程仓库
git pull origin master – 将远程仓库内容拉取到本地仓库
git remote -v – 查看远程仓库配置
git remote add origin https://gitee.com/iotedu_1_13971656409/coms.git – 给现有仓库添加远程仓库
git remote rm origin – 移除与远程仓库的关联
git config --list – 查看全局配置
git config --get user.name – 查看user.name配置
git config --global credential.helper store – 保存远程仓库账号密码(稍后用 git pull 输入账号密码)
git config --system --unset credential.helper – 清除本地保存的远程仓库账号密码,重新登录

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com