Git Bash 經常使用指令

1. 關於git bash經常使用指令 推薦博客:

史上最簡單的 GitHub 教程 git

猴子都能懂的GIT入門github

Learn Version Control with Git for Free安全

Git Documentation  bash

Git Bookapp

2. 經常使用指令:

git config --global user.name "名字"fetch

git config --global user.email "郵箱"spa

git status 查看當前狀態.net

git init 初始化本地倉庫rest

git add 「filename」blog

git commit –m 「註釋」

git log

git branch 查看分支

git branch a 建立分支a

git checkout a 切換到a分支

git merge a 將分支a合併到當前分支

git branch –d a 刪除分支a

git branch –D a 強制刪除分支a

git push origin master

git pull origin master  把遠端origin的master分支的最新版本拉取到本地,自動merge

git fetch origin master  把遠端origin的master分支的最新版本拉取到本地,不merge,較安全

git clone https://github.com/...  克隆遠程倉庫

git remote add origin https://github.com/...   關聯遠程倉庫

git reset --hard 版本號       回滾到特定版本

git push -f origin master     將本地的當前版本強制提交到遠程倉庫中

注意:在咱們向遠程倉庫提交代碼的時候,必定要先進行pull操做,再進行push操做,防止本地倉庫與遠程倉庫不一樣步致使衝突的問題。


 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

reset

Reset current HEAD to the specified state

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

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

checkout

Switch branches or restore working tree files

commit

Record changes to the repository

diff

Show changes between commits, commit and working tree, etc

merge

Join two or more development histories together

rebase

Reapply commits on top of another base tip

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

相關文章
相關標籤/搜索