首页 > 其他分享 >Git 命令手册

Git 命令手册

时间:2022-11-07 20:48:49浏览次数:43  
标签:git name -- 手册 命令 Git branch commit config

$ git config --global user.name 'user_name'
$ git config --global user.email 'user_email'
$ git config --global http.sslCAInfo /XXXX/XXX/XXX.crt
$ git config --global --list
$ git config --global http.sslVerify "false"
$ git config --global credential.helper store
$ git config --global alias.hist "log --color --graph --pretty=format:'%Cred%h%Creset - %Cgreen(%ci)%Creset %s %C(bold blue)<%an>%Creset%C(yellow)%d%Creset' --abbrev-commit"
$ git config --global alias.recover '!git clean -df && git reset HEAD --hard'
$ git config --global alias.updbr '!git checkout master && git branch -D feature/code_association_rule_mining && git pull --ff-only && git checkout feature/code_association_rule_mining'

$ git log --author='author_name' --before='yyyy-mm-dd hh:mm:ss' --after='yyyy-mm-dd hh:mm:ss' --first-parent
$ git log --follow -- 'filepath'
$ git revert 'commit-id' --no-merge

# calculate number of lines of code changed 
$ git diff --stat  OR  $ git log --stat

$ git diff 'from'..'to' -- 'filepath'

# pull = fetch + merge
$ git fetch 'repo' 'branch'
$ git diff 'from'..'to' -- 'filepath'
# with some process...
$ git merge '@{u}'

$ git tag 'light-weight tag name' 'commit-ish'
$ git tag -a 'anotated tag name' -m 'tag message'
$ git push 'repo' 'tag name'

# rename branch locally and remotely
$ git branch -m ['old_br_name'] 'new_name'
$ git push 'repo' :'old_br_name'
$ git push 'repo' -u 'new_name'

# remove remote branch
$ git push -d 'repo' 'branch'
$ git remote prune origin  # or: git fetch -p


$ git rebase --onto 'target_commit-ish' 'start_commit-ish(exclude)' 'end_commit-ish(include)'
$ git rebase --quit

$ git remote add origin 'url'

# to see commit that certain-branch doesn't have but current branch does have
$ git cherry -v 'certain-branch' 

# 1st merge of commit-ish
$ git log --merges 'commit-ish'..HEAD --ancestry-path --pretty=format:'%H %ct' | tail -1

# to see all commit id of merges that merges into branch of name "br_name"
$ git log --pretty=format:%H --merges --first-parent 'br_name'
# to see changing statistics of certain commit
$ git show 'commit-id' --pretty=format:%aI --numstat

$ git log -p --merges --first-parent 'br_name'

# to see history of a specific line of a file
$ git log -L 'startline','endline':'filepath'

# to see merges from a commit until now
$ git log --reverse --merges 'commit-id'..HEAD

$ git diff --unified=

# extract commits to patch file
$ git format-patch -4 HEAD 
# apply commits
$ git am *.patch

# change remote repository of `master` branch
$ git remote rename origin old
$ git remote add origin 'repositiory-url.git'
$ git config branch.master.remote origin

# GIT LFS smudge报错:
# error: external filter 'git-lfs filter-process' failed
# fatal: DataSource/codex/phoenix-5.0.0.3.0.1.0-187-client.jar: smudge filter lfs failed
# 规避方法:
# Skip smudge - We'll download binary files later in a faster batch
$ git lfs install --skip-smudge
#  Do git clone here
$ git clone ...
# Fetch all the binary files in the new clone
$ git lfs pull
# Reinstate smudge
$ git lfs install --force

# Clone repo without SSL verify:
$ git -c http.sslVerify=false clone 'repositiory-url.git'

$ git config http.sslVerify "false"

标签:git,name,--,手册,命令,Git,branch,commit,config
From: https://www.cnblogs.com/LexLuc/p/16867358.html

相关文章

  • 用blkid命令解读grub.cfg文件中的块设备
      ubuntu引导配置文件grub.cfg真是越来越难看懂了:启动菜单里找不到类似root=/dev/sda这种存放根文件系统的块设备名,取而代之的是一堆让人摸不着头脑的UUID:menuentry'......
  • windbg中通过文件句柄查找设备(!handle/!fileobj/!devobj命令)
      有时,在驱动程序中会调用ZwCreateFile获得设备句柄,然后保存在设备扩展区域中供其他例程使用。由于驱动程序经常被动调用----执行的上下文可能不是同一个线程----会获得......
  • git submodule add 报错SSL certificate problem unable to get local issuer certifi
    在使用hugo并安装主题时遇到的错误SSLcertificateproblem:unabletogetlocalissuercertificate(base)PSE:\vscodeProject\chz8bit.github.io\quickstart>gitsu......
  • git 代码回滚
    方法一:gitreset回滚到指定的commit_id版本使用gitlog查看当前提交的历史内容根据回滚版本所对应的commitSHA-1值来进行回滚操作:gitreset--hardSHA-1当......
  • [Linux入门必备]17个案例带运维小白快速精通Awk命令,拿来即用!
    awk是一个强大的文本分析工具,相对于grep的查找,sed的编辑,awk在对数据分析并生成报告时,显得尤为强大。简单来说awk就是把文件逐行的读入,以空格为默认分隔符将每行切片,切开的......
  • Serverless 产品手册
    ......
  • git设置SSH密钥
    Git是分布式的代码管理工具,远程的代码管理是基于SSH的,所以要使用远程的Git则需要SSH的配置。git设置密钥的步骤如下:步骤1在客户端查看有无密钥命令行输入:cd~/.ssh如果提示......
  • 用username.github.io在github创建一个个人空间
    对于技术人员来说,分享技术新的、学习经验都有许多平台,比如我们常用的CSDN,很多技术人员都会在上面创建自己的博客。但是以这种方式来分享,可能没有那么个性化,因此我们可以在gi......
  • git修改远程仓库地址
    方法有三种:修改命令gitremoteset-urlorigin[url]先删后加gitremotermorigingitremoteaddorigin[url]直接修改.git/config文件......
  • git 问题解决
    1.fatal:theremoteendhungupunexpectedlygitconfig--globalhttp.postBuffer104857600其他方案:gitconfig--globalpack.windowMemory100mgitconfig-......