git學習記錄

1、git官網laravel

http://git-scm.com

2、查看git安裝路徑git

which git

3、 配置configgithub

git config --global user.name "jihaichuan"
git config --global user.email "jihaichuan@126.com"

4、初始化gitweb

git init

5、添加全部的本地文件vim

git add .

6、 提交文件緩存

git commit -m 'install laravel'

7、 刪除緩存區的編輯器自帶的文件夾 .idea目錄bash

​git rm -r --cached .idea/

8、 新增 「add-web-page」 分支服務器

git branch add-web-page   #新增分支

9、 查看全部分支ssh

git branch

10、 切換 add-web-page 分支編輯器

git checkout add-web-page
git checkout -b add-web-page #新增分支並直接切換到該分支

11、 合併 add-web-page 分支, 首先須要切回到 master 分支上面

git marge add-web-page

12、 刪除 add-web-page 分支

git branch -d add-web-page

十3、 配置git快捷命令

git config --global alias.s status
git s #至關於  git status

十4、 刪除配置的git快捷命令

git config --global --unset alias.s

十5、 把已有的項目推送到github上面

git remote add origin https://github.com/jihaichuan/xiaocx.org.git
git push -u origin master

十6、把本地項目push到 github 上面

git push

十7、 查看git日誌,圖像化

git log --graph

十8、 在服務器上面git pull時不須要重複的輸入帳號和密碼,編輯vim .git/confg在底部新增

[credential]
        helper = store

十9、 更新服務器代碼

git pull
git pull origin master

二10、 查看版本直接的不一樣

git diff

二11、 恢復到上傳提交的版本

git reset --hard 32323432

二12、 生成ssh祕鑰

ssh-keygen
cat ~/.ssh/id_rsa
cat ~/.ssh/id_rsa_pub

二十3、 查看git提交的遠程地址

git remote -v
相關文章
相關標籤/搜索