Git常用命令及操作

2021-10-08 09:50:04 字數 1133 閱讀 1912

commands

contents

git init

建立版本庫

git add

加入檔案

git commit -m 「***」

本次提交說明

git status

倉庫當前狀態

git diff

檢視修改內容

git log

檢視提交日誌

git reset –hard head

版本回退

git reset –hard

版本回退

git reflog

檢視命令歷史

新增本地分支

git checkout ***

切換本地分支

git push origin ***

推送到遠端分支***

git pull

從遠端分支拉取

home目錄下建立檔案.git-credentials, 並在此檔案中新增:

# 注意去掉{}

在終端下執行

git config --global credential.helper store

可以看到~/.gitconfig檔案,會多了一項:

[credential]

helper = store

方法有三種:

修改命令

git remote set-url origin [url]

# 例如:

# git remote set-url origina [email protected]:php/hasoffer.git

先刪後加

git remote rm origin

git remote add origin [url]

直接修改config檔案

Git常用命令及操作

git config global user.name tom git config global user.email tom test.com 每次git提交都會使用該使用者資訊。檢視所有配置資訊 git config l 檢視全域性使用者配置 git config global list 檢視...

git操作步驟及常用命令

git config global credential.helper store 記住當前登入使用者名稱 密碼 git config system unset credential.helper git push origin delete chapater6 刪除遠端分支 git remote ...

git及常用命令

git 是乙個分布式版本控制工具,不必伺服器端軟體支援,使源 的發布和交流極其方便 git 的優勢主要有 1.git是分布式的,這是git和其它非分布式的版本控制系統 svn,cvs 最核心的區別。從中心版本庫的伺服器上chect out 後會在自己的機器上轉殖乙個自己的版本庫。它支援離線工作 本地...