1. git 安裝
2.git 與服務器的驗證
1.生成ssh
ssh-keygen -t rsa -C "1107247128@qq.com"
2.查看生成的pub文件,並把秘鑰添加到Git上
3.測試連接ssh
ssh -T
git@git
git@git.lagou.com
3.設置本機在git中的身份
git config --global user.name "zhidanwang19910111"
git config --global user.email "1107247128@qq.com"
4.創建一個庫用來管理代碼
1.git init
2.git remote add origin "遠程庫的ssh"
3.將文件拷貝庫
4.git add .
5.git commit -m ""
6.git push -u origin master
7.git remote -v 查看遠程倉庫
8.git remote rm origin 刪除遠程倉庫
5.創建一個分支
git branch 查看當前有幾個分支
git branch -a 查看全部分支,遠程分支會紅色表示出來
git checkout -b "分支名稱"
git checkout 切換分支
git push origin "分支名稱"
git branch -m old_branch new_branch # Rename branch locally 分支重命名
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
6. 強制回滾
git reset --hard e377f60e28c8b84158
git push -f origin master
git log -3