git&github使用筆記,先記著以後忘了方便貼上!
1. 在電腦安裝好git後配置:
右擊滑鼠右鍵點開」git bash here"
git config --global user.name "your name"
git config --global user.email "[email protected]"
可以去掉後面的引號及裡面的東西,再次輸入命令可以檢視當前配置資訊。
比如:git config --global user.name
2.初始化:
建立乙個資料夾進入裡面執行 「git init」建立了乙個倉庫,管理這個資料夾裡面的東西,裡面有隱藏資料夾 .git 裡面是配置檔案。
git init
3.檢視檔案狀態:git status
4.新增到快取區中:git add 檔案1
git add 檔案1 檔案2 檔案3 ..
.....
git. //新增當前目錄
5.提交到版本庫:git commit -m 「注釋」
6.版本回退
檢視版本號:兩種顯示方式
git log
git log --pretty=online
回到過去再回來
git reflog
回退操作
git reset --hard 版本號
7.倉庫的兩種管理方式
git clone 被轉殖的線上倉庫位址
git add 目錄
git commit -m 「注釋」
git push 提交線上倉庫
配置.git/config再url中加入使用者名稱和密碼
url = https://使用者名稱:密碼@github.com/使用者名稱/倉庫名.git
ssh:
先安裝好openssh
本地建立公私鑰對檔案
ssh-keygen -t rsa -c "[email protected]"
連續回車,.pub為公鑰
上傳公鑰儲存:轉殖那裡新增公鑰
git clone 被轉殖的線上倉庫位址
git add 目錄
git commit -m 「注釋」
git push 提交線上倉庫
8.分支管理
檢視分支
git branch
建立分支
git branch
切換分支:
git checkout 《分支名》
建立新分支《分支名》並切換到新的分支上
git checkout -b 《分支名》
合併某分支到當前分支
git merge 《被合併的分支名》
刪除分支:要退出被刪分支
git branch -d 《分支名》
9.使用前:git pull
10.忽略檔案:
touch .gitignore檔案:生效與當前目錄和子目錄
touch .gitignore
#過濾資料夾
/js/
#過濾所有.zip包
*.zip
#過濾某具體個檔案
/js/index.php
#不過濾某個檔案
!index.php
Git Github使用教程
一 配置github 1.註冊github賬戶renle177 2.新建 庫linux test 以上操作省略.二 本地操作配置 linux環境 1.安裝git及配置環境 yum y install git git config global user.name renle177 git confi...
Git GITHUB簡單使用
一 概念 git本地倉庫 別人的本地倉庫 通過遠端倉庫實現 通訊更新 二 遠端端 託管 1.註冊github賬號 2.建立遠端倉庫 new repository 輸入倉庫名稱,生成倉庫鏈結 my git 三 本地倉庫建立 1.安裝git msysgit.github.io 配置到系統路徑 2.配置使...
Git GitHub簡單使用
time 2019 2 26 theme git使用說明 2.安裝好git 之後,兩個快捷方式 1.開啟git bash 進入上面檔案目錄下 或者在檔案資源器中進入該目錄,然後右鍵 git bash here 2.輸入 git config global user.name github使用者名稱 ...