git 標籤
使用 tortoisegit 管理檔案版本
在 idea 中使用 git
使用 ssh 協議傳輸資料
當安裝完git首先要做就是設定使用者名稱和e-mail位址
設定使用者資訊
git config --global user.name 「zsl」
git config --global user.email 「[email protected]」 #並不會校驗
檢視配置資訊
git config --list
git config user.name
通過上面的命令設定的資訊會被儲存在~/。gitconfig 檔案中
本地初始化
git init
遠端倉庫轉殖
git clone
版本庫:.git,中儲存了配置資訊、日誌資訊和檔案版本資訊等
工作目錄(工作區):包含.git資料夾的目錄就是工作目錄,主要用於存放開發的**
暫存區:.git資料夾中有很多檔案,其中有乙個index檔案就是暫存區,也可以叫做stage。暫存區是乙個臨時儲存修改檔案的地方
untracked 未跟蹤 (未被納入版本控制)
tracked 已跟蹤 (被納入版本控制)
git status 檢視倉庫狀態 -s 更整潔
git add 新增檔案到暫存區
git reset head 將暫存區檔案移除
git commit -m "init hello.txt「 將暫存區檔案提交到本地倉庫
git rm 刪除檔案(工作區檔案) 直接commit提交
將檔案新增至忽略列表
.gitignore
# no .a files
*.a# but do track lib.a, even though you're ignoring .a files above
!lib.a
# only ignore the todo file in the current directory, not subdir/todo
/todo
# ignore all files in the build/ directory
build/
# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt
# ignore all .pdf files in the doc/ directory
doc/**/*.pdf
git log 檢視日誌記錄
git remote 檢視遠端倉庫 -v詳細檢視 show origin
git remote add 新增遠端倉庫
git clone 從遠端倉庫轉殖
git remote rm 移除(本地)無效的遠端倉庫
git fetch mer 從遠端倉庫中抓取,不會自動merge
git merge origin/master
git pull [remote-name] [branch-name] 從遠端倉庫中拉取,會自動merge
本地倉庫存在檔案報錯時git pull --allow-unrelated-histories
git push [remote-name] [branch-name] 推送到遠端倉庫
# 列出所有本地分支
git branch
# 列出所有遠端分支
git branch -r
# 列出所有本地分支和遠端分支
git branch -a
# 列出所用tag
git tag
# 檢視tag資訊
git show [tag]
# 刪除本地tag
git tag -d [tag]
# 刪除遠端tag
git push [remote-name] :refs/tags/[tag]
1)ssh-keygen -t rsa 生成公鑰和私鑰,執行完成後在window本地用)戶.ssh目錄c:\users\使用者名稱.ssh下面生成私鑰(id_rsa)和公鑰(id_rsa.pub)
2)複製公鑰檔案內容至碼雲伺服器
git基礎用法
git基礎用法 1.初始化git git init2.自己要與origin master建立連線 git remote add origin 倉庫位址3.拉取遠端分支 git fetch origin master4.在本地建立分支dev並切換到該分支 git checkout b master o...
Git基礎用法
撤銷操作 檢視本地檔案狀態 分支操作 遠端倉庫操作 git initgit add 代表當前目錄下所有檔案跟蹤,你也可以 git add 檔名 git commit m 提交注釋 git commit amendgit reset head contributing.mdgit checkout c...
2021 02 20Shell基礎程式設計筆記
一 重啟磁碟修復 fsck 二 shell中變數的宣告 引用及作用域 變數賦值 等號兩邊不能有空格 如果要給變數賦空值,在等號後面跟換行符 顯示變數的值 echo variable echo 清除變數 unset variable 顯示所有的變數 set環境變數也就是全域性變數,按規則要大寫 exp...