Git的一些基本命令

2021-08-21 16:09:57 字數 2208 閱讀 8074

$ git config -

-global user.name "your name"

$ git config -

-global user.email "[email protected]"

什麼是版本庫呢?
$ mkdir directory

$ cd directory

$ pwd

/users/project/directory

$ git init
把工作區的內容提交到暫存區
$git add "***"
$git add .
$ git add -u
$ git add -a
檢視當前檔案的狀態
$git status
把暫存區內容提交到歷史區
$ git commit
$ git commit -m "提交的記錄名字"
$ git commit -a -m "提交的記錄名字"
檢視提交歷史記錄
$ git log
$ git reflog
$ git lg
git config -

-global alias.lg "log --color --graph --pretty=format:'%cred%h%creset -%c(yellow)%d%creset %s %cgreen(%cr) %c(bold blue)<%an>%creset' --abbrev-commit"

暫存區所有內容撤回工作區
$ git rm -

-cached . r

$git chechout .
$git reset head .
$git reset -

-hard "***"

檢視各個區域的**變動
$ git diff
$ git diff master
$ git diff -

-cached

將工作區的內容進行儲存
$ git  stash

本地倉庫和遠端倉庫保持關聯

$ git remote add "***"
$ git remote rm "***"
$ git remote -v
讓本地歷史區資訊和遠端倉庫資訊保持同步
$ git push origin master
$ git push origin head:master
$ git pull origin master
$ git fetch origin master-auth:master-auth
$ git clone  "url"
操作分支的基礎命令
$ git branch
$ git branch "***"
$ git chechout "***"
$ git chechout -b "***"
$ git checkout -b  "***"

[本地新建立分支名字] origin[遠端倉庫名]

/"***"

[遠端倉庫的分支]

$ git branch -d "***"
$ git merge "***"
$ git log -

-graph /

--oneline

git的一些基本命令

1 建立乙個新的倉庫 選擇乙個合適的地方,建立乙個空目錄 1 mkdir learngit learngit是用git新建的乙個目錄 2 cd learngit 3 pwd pwd命令用於顯示當前目錄 2 通過git init命令把這個目錄程式設計git可以管理的倉庫 git init 3 用git...

MySQL一些基本命令

1 mysql服務的啟動和停止 net stop mysql net start mysql 2 登陸mysql 語法如下 mysql u使用者名稱 p使用者密碼 鍵入命令mysql uroot p,回車後提示你輸入密碼,輸入12345,然後回車即可進入到mysql中了,mysql的提示符是 mys...

一些Linux (ubuntu )基本命令

新增使用者 useradd username 更改密碼 sudo passwd username 修改 etc sudoers 可以為使用者賦予 sudo 許可權 給某ip機器遠端訪問mysql 的許可權 mysql grant all privileges on to username 1.2.3...