推荐入门视频:
https://www.bilibili.com/video/BV1vy4y1s7k6?spm_id_from=333.337.search-card.all.click
# 从服务器上clone一个repo
git clone https://10.150.98.175:1990/voice/lmh_test.git #20使用ssh方式失败,使用https方式
# 查看git状态
git status
# 添加文件使其处于被追踪状态
git add text
# 删除暂存区记录文件
git rm --cached <file>
# 提交
git commit -m '提交说明'
# 查看精简版本信息
git reflog
# 输出最近2次提交的历史并提交引入的差异
git log -p -2
# 输出你的提交历史、各个分支的指向以及项目的分支分叉情况。
git log --oneline --decorate --graph --all
# git版本穿梭
git reset --hard <版本号>
# 新建分支
git branch test
# 查看分支
git branch -v
# 切换分支
git checkout test
# 新建并切换分支
git checkout -b test
# 合并分支,先切换到合并到的分支,然后在合并
git checkout master
git merge test # 将 test 分支 合并到 master 上
# 如果merge过程中遇到冲突(master|MERGING),需要手动修改,然后重新add <file>,并直接 commit 合并,commit的时候不需要添加文件命
# 查看远程仓库信息
git remote -v
# 添加远程仓库并且取别名
git remote add <new_name> https:xxxx//xxxx
# 远程仓库推送, 将 master 分支推送到远程库
git push <new_name> master(分支名)
# 更新本地分支
git pull master
# 克隆远程仓库
git clone https:xxxx//xxxx.git
团队协作示图:
跨团队协作示图: