SHH
ssh-keygen -t rsa -b 4096 -C "happy-yan"
#下载代码
git clone git@gitee.com:wang-66/diff-power.git --depth 10
#对于一些很久的分支,要用这个更新一下子模块
git submodule update --init --recursive
#查看状态,确定一下是否有没有track的子模块
git status
git config --global user.email"hhh"
git config --global user.name"happy-yan"
git checkout -b happy/0817_test
git add xx.py
#添加评论
git commit -m"[planner]:add st boundary pre decider test"
#第一次修改要添加一个新分支
git push --set-upstream origin happy/0817_test
#分支撤回
git reset --soft HEAD^
#分支撤回再修改可能会碰到无法同步提交的情况,那么要使用下面的代码强制提交:
git push -f
#列出所有的分支
git remote -v
#添加gitee仓库里面的新分支
git remote add origin2 git@gitee.com:wang-66/altc.git
#拉取新分支的东西
git fetch origin2 --depth 10
#将修改的新分支合并到主支上
#git merge 用于将两个分支的历史合并,它会创建一个新的合并提交,并保留前两个分支的历史。
- 当你在目标分支(如main)上运行 git merge feature-branch 时,Git会将 feature-branch 分支的合并到当前分支。
- 如果两个分支没有冲突,git会自动创建一个新的合并提交,将这两个分支的历史记录结合到一起。
- 如果存在冲突,git会要求你手动解决冲突,然后创建合并提交。
- 例:git merge happy/0817_test
#git rebase是另一种合并更改的方式,但它通过重新应用提交来改变历史记录,使提交历史更加线性。
- 当你在 feature-branch 上运行 git rebase main 时,Git会将 main 分支上的所有提交应用到 feature-branch 之上。
- 实际上, git rebase 会将 feature-branch 上的每个提交暂时保存起来,然后将它们一一应用到 main 分支的最新提交之后,形成一个新的提交链。
- 如果遇到冲突,git会要求你手动解决冲突,并使用git rebase --continue继续操作。
206




被折叠的 条评论
为什么被折叠?



