git共分為4個區,分別是:
workspace:工作區
staging area:暫存區/快取區
local repository:或本地倉庫
remote repository:遠端倉庫
git config --global user.name "github名字"
git config --global user.email "github郵箱"
git config --global user.name "github名字"
配置名字
git config --global user.email "github郵箱"
配置郵箱
git config user.name
檢視配置的名字
git config user.email
檢視配置的郵箱
git config --list
檢視所有配置資訊
git init
git初始化
git add 檔名
新增文字至快取區
git commit -m 「提交描述」
提交快取區檔案到本地倉庫
git push -u origin master
將本地倉庫內容推送至遠端倉庫
-- 藍色字型實際環境可能有所變化
git status
檢視狀態
git diff 檔名
檢視檔案不同之處
git log
檢視最近提交日誌
git log --pretty=oneline
檢視最近提交簡潔日誌
git log --pretty=oneline --abbrev-commit
檢視歷史提交的commit id
git reset --hard head/版本id前6位+
既可回退版本,亦可把暫存區的修改回退到工作區
-- head表示最新版本
git checkout -- 檔名
插銷修改
git reset head 檔名
把暫存區的修改撤銷掉,重新放回工作區
git remote add origin [email protected]:duanyadian/self-study.git
本地倉庫關聯遠端倉庫
-- 藍色字型根據實際環境填寫
git clone [email protected]:duanyadian/self-study.git
從遠端庫轉殖到本地倉庫
-- 藍色字型根據實際環境填寫
git checkout -b 分支名
git switch -c 檔名
建立並切換到分支
git branch 分支名
僅建立分支
git switch 分支名
切換分支
git branch
檢視當前分支
git merge 指定分支名
快速合併指定分支到當前分支
git merge --no-ff -m "描述文字" 指定分支名
普通合併指定分支到當前分支
git branch -d 分支名
刪除分支
git tag 標籤號
建立標籤
git tag
檢視標籤
git tag 標籤號 commit id
對commit id 打標籤號
git show 標籤號
檢視標籤資訊
git tag -a 標籤名 -m 「標籤說明」 commit id
對commit id建立帶有說明的標籤
-a
指定標籤名,-m
指定說明文字
git tag -d 標籤號
刪除標籤
git push origin :refs/tags/標籤號
從遠端庫刪除標籤
git push origin 標籤號
推送某標籤到遠端倉庫
git push origin --tags
一次性推送所有標籤至遠端倉庫
vim、cat、ll、cd、pwd、rm、touch、mkdir等
常用linux命令,在git下使用,不做過多解釋
產生衝突
解決衝突
Git基本流程及常用命令
git共分為4個區,分別是 workspace 工作區 staging area 暫存區 快取區 local repository 或本地倉庫 remote repository 遠端倉庫 git config global user.name github名字 git config global ...
Git常用命令及使用流程
gitignore 是 git 倉庫中的乙個特殊的文字檔案,它裡面記錄了你不希望提交到倉庫的目錄和檔案的名稱或型別 git 目錄,就是你的本地倉庫 local repository 你的所有版本資訊都會存在這裡 git 所在的這個根目錄,稱為 git 的工作目錄 working directory ...
Git基本工作流程 常用命令
git基本工作流程 git版本 git常用命令 git commit 提交,將暫存區檔案提交到歷史倉庫 git log 檢視日誌 git提交的歷史日誌 git歷史版本切換 git 分支 切換分支 檢視檔案命令 ls 檢視分支列表 合併分支 刪除分支 git遠端倉庫操作流程 git 遠端參倉庫平台 g...