Git base operate
1. 創建目錄文件夾并進入 pwd可查看現在所在的位置
mkdir folder
2. git創建
git init
3. 說明文檔創建
touch README.md
4. 將改動添加到暫存區
git add.
5. 添加提交說明
git commit -m ‘版本1’
6. 將本地更改推送到遠程分支
git push -u origin master
Git branch
git branch -r 查看遠端分支
git branch -a 查看本地及遠端分支
git checkout -b master 切換并創建分支
git branch 查看本地分支
Git global setup
git config --global user.name "zhouen"
git config --global user.email "xxxx@163.com"
Create a new repository
git clone http://192.168.1.134/zhouen/test.git
cd test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
git pull origin master
git clone -b master http://192.168.1.134/zhouen/test.git 克隆某個分支到本地
Existing folder
cd existing_folder
git init
git remote add origin http://192.168.1.134/zhouen/test.git
git commit -m "Initial commit"
git push -u origin master
git add . 添加變化的內容包括新文件但不包括被刪除的文件 到暫存區域
git add —all 添加變化的內容包括新文件同時包括刪除的文件 到暫存區域
git remote -v
git remote remove remote_name
git remote set-url remote-name new_url
Existing Git repository
cd existing_repo
git remote add origin http://192.168.1.134/zhouen/test.git
git push -u origin --all
git push -u origin --tags