zoukankan      html  css  js  c++  java
  • Git command

    git config --global user.name "example"
    git config --global user.email "example@example.com"
    git config --global core.editor emacs
    git config --global color.status auto
    git config --global color.diff auto
    git config --global color.branch auto
    git config --global credential.helper cache
    git config --global credential.helper 'cache --timeout=3600'
    git config --global push.default simple

    git config --global --list

    add alias gs='git status' in .bashrc

    Two ways to get a repository
    Clone someone else's - git clone
    Make your own - git init

    git add *.c (add all C source files in the current folder)
    git add *.c (add all C source files in the current folder and all subfolders)
    git add . (add everything, be careful)

    git commit -a
    git commit -m <comment>

    git commit --amend

    git rm <file> ---- removes <file> from Git and deletes it as well
    git rm --cached <file> leaves it hanging in the directory, it's just gone from git

    git mv <src> <dst>

    git log
    git log <path>
    git diff
    git diff --cached

    edit .gitignore --- the files you don't want to save

    git branch --- inspect the branches
    git checkout branch_a --- switch to branch a
    git checkout -b branch_b --- create branch b and switch to b
    git merge branch_a
    git mergetool

  • 相关阅读:
    KMP算法的理解和代码实现
    关于线程死锁
    PAT1018
    PAT1059
    PAT1009
    PAT1006
    PAT1005
    PAT1004
    PAT1002
    PAT
  • 原文地址:https://www.cnblogs.com/null00/p/3133474.html
Copyright © 2011-2022 走看看