git 命令

Last updated on November 22, 2024 pm

🧙 Questions

git日常生活中常用的命令

☄️ Ideas

用户初始化
git config --global user.email "ispong@outlook.com"
git config --global user.name "ispong"
建立远程分支连接
# 将远程的main分支绑定到本地的main上
git branch --set-upstream-to=upstream/main main
查看git配置
git config --global -l
查看当前分支
git branch -vv
查询远程origin
git remote -v
git remote set-url origin https://xxx@github.com/ispong/isx-cli.git
git remote set-url upstream https://xxx@github.com/isxcode/isx-cli.git
临时身份登录凭证
git config --global credential.helper cache 
git config --global credential.helper 'cache --timeout=3600'
重新提交
git commit --amend -m ":sparkles: recommit"
git push origin main
删除远程文件
git rm -rf --cached xx/xxx
git add .
git commit -m ":fire: delete xx/xxx"
git push origin main
初始化项目
git init
git remote remove origin
git remote add origin git@git.dfy.definesys.cn:ispong/ispong-chunjun.git
git add .
git commit -m ":tada: init project"
git push origin main
查看分支来源
git reflog show papaas-feature-F002020

da776245 (papaas-feature-F002020) papaas-feature-F002020@{0}: pull: Fast-forward
b4b13cf1 papaas-feature-F002020@{1}: merge origin/papaas-feature-F002020: Merge made by the 'recursive' strategy.
b1cdcb6b papaas-feature-F002020@{2}: commit: fix(融合打通): 修复创建用户逻辑
9c7fb014 papaas-feature-F002020@{3}: pull: Fast-forward
1a01ef1c papaas-feature-F002020@{4}: pull: Fast-forward
5c805a6f papaas-feature-F002020@{5}: commit (merge): merge(合并冲突): papaas-feature-F002020 合并冲突
c3ef6e19 papaas-feature-F002020@{6}: pull: Fast-forward
484fc6cc papaas-feature-F002020@{7}: pull: Fast-forward
6ed53314 (`HEAD -> 0.25, origin/0.25, 0.25-bugfix`) papaas-feature-F002020@{8}: branch: Created from HEAD
动态log
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
git log --graph --pretty=format:' %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
# 查询并显示改动的文件
git log --stat

# 查询commitId的信息和修改内容
# git show 09bbf4f6cde3458c6e13ebbb555d917c25db8b86
git show ${commitId}

git 命令
https://ispong.isxcode.com/github/git/git 命令/
Author
ispong
Posted on
March 21, 2022
Licensed under