Git 常用命令记录

Git 常用命令记录

git config user.name // 查看用户名

git config user.email // 查看邮箱

git config --global user.name “name” // 修改用户名

git config --global user.email “email” // 修改邮箱

git config --global core.longpaths true // 解决文件名太长问题

git clone url -b branch // 拉取指定分支代码

git branch // 查看本地分支

git branch -r // 查看远程分支

git branch branch_name // 新建一个本地分支

git branch -d branch_name // 删除一个本地分支

git branch -D branch_name // 强制删除本地分支

git checkout branch_name // 切换本地分支

git status . // 查看当前分支代码状态

git add . // 添加当前分支所有修改

git add file_path // 添加单独文件的修改

git commit . // 提交所有 add 的文件到本地临时仓

git commit -s // 提交代码,并编辑提交信息

git commit --amend // 提交修改代码到最近一次 commit 上,可修改提交信息

git pull // 拉取当前本地分支关联的远程分支的代码

git pull origin branch_name // 拉取远程分支的代码

git pull --rebase origin branch_name // 拉取相关远程分支代码,并进入 rebase 过程

git rebase --continue // 继续 rebase 过程(下一步)

git push origin local_branch:origin_branch // 推送到远程分支,origin_branch 可以直接命名新分支,并会在远程仓生产新分支

git reflog // 查看本地git操作历史记录

git reset --hard commit_id // 回退本地代码到某一节点

git clean -d -f && git reset --hard HEAD // 清理本地仓,并回退本地代码到最新节点

git log // 查看commit 记录

git show // 查看最近一次 commit 记录

git show commit_id // 查看某一次 commit 记录

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值