从某分支下载代码
git clone -b <branch_name> <url>
创建分支
git branch <branch_name>
切换分支
git checkout <branch_name>
上传代码到某分支
git add .
git commit -m '更新内容'
git remote add origin 远程仓库地址 (←设置过就不用再设置了)
git push -u origin 分支名
合并分支
git checkout master # 进入要合并的目标分支,不一定是master
git merge <branch_name>
git commit 提交更新内容,不写就默认源分支更新的那条内容
git push 提交本地仓库代码到远程仓库
撤销提交分支到远程仓库 (撤销push)
git log # 按q退回
git reset –-soft <版本号>
git push origin 分支名 –-force
撤销commit
git log # 看前一个版本号
git reset --hard commit_id
git log # 看现在的情况