xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

图解 git

图解 git

$ git --version
# git version 2.24.3 (Apple Git-128)

$ git --help
###
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone     Clone a repository into a new directory
   init      Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add       Add file contents to the index
   mv        Move or rename a file, a directory, or a symlink
   restore   Restore working tree files
   rm        Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
   bisect    Use binary search to find the commit that introduced a bug
   diff      Show changes between commits, commit and working tree, etc
   grep      Print lines matching a pattern
   log       Show commit logs
   show      Show various types of objects
   status    Show the working tree status

grow, mark and tweak your common history
   branch    List, create, or delete branches
   commit    Record changes to the repository
   merge     Join two or more development histories together
   rebase    Reapply commits on top of another base tip
   reset     Reset current HEAD to the specified state
   switch    Switch branches
   tag       Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
   fetch     Download objects and refs from another repository
   pull      Fetch from and integrate with another repository or a local branch
   push      Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.
###

git basic

$ git status

$ git diff

$ git add .

$ git commit -m"feat: add a new ferature"

$ git pull

$ git push

$ git merge

$ git rebase



git advanced

# delete git commit history 
$ git filter-branch

git filter-branch

remove git commits history

$ git clone https://github.com/xgqfrms/xgqfrms

# git checkout gh-pages
$ cd github/xgqfrms

$ git filter-branch --force --index-filter \
  "git rm --cached --ignore-unmatch tools/WebStrom-2016.2.4.md" \
  --prune-empty --tag-name-filter cat -- --all

# what's `\` & `""` means in git cli???
$ git filter-branch --force --index-filter "git rm --cached --ignore-unmatch tools/WebStrom-2016.2.4.md" --prune-empty --tag-name-filter cat -- --all


gif 图解 git

  • git merge
  • git rebase
  • git reset
  • git revert
  • git cherry-pick
  • git fetch
  • git pull
  • git reflog

https://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1

refs

https://www.cnblogs.com/xgqfrms/p/13338946.html

remove GitHub git commit history

https://learngitbranching.js.org/

https://github.com/pcottle/learnGitBranching

https://zhuanlan.zhihu.com/p/122474549

https://github.com/geeeeeeeeek/git-recipes/wiki



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2020-09-06 11:08  xgqfrms  阅读(183)  评论(2编辑  收藏  举报