forked from NUDT-compiler/nudt-compiler-cpp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.9 KiB
1.9 KiB
Lab1
1.构建
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCOMPILER_PARSE_ONLY=ON cmake --build build -j "$(nproc)"
2.单例查看
./build/bin/compiler --emit-parse-tree test/test_case/functional/simple_add.sy
3.批量检查
find test/test_case -name '*.sy' | sort | while read f; do ./build/bin/compiler --emit-parse-tree "$f" >/dev/null || echo "FAIL $f"; done
核心原则:不要在“落后于远端 master”的本地 master 上直接开发和提交。
你以后按这套流程,基本就不会分岔。
日常标准流程
- 每次开始前先同步主干
git switch master
git fetch origin
git pull --ff-only origin master
- 从最新 master 拉功能分支开发
git switch -c feature/xxx
- 开发中频繁提交到功能分支
git add -A
git commit -m "feat: xxx"
- 推送功能分支(不要直接推 master)
git push -u origin feature/xxx
- 合并前,先把你的分支“重放”到最新 master 上
git fetch origin
git rebase origin/master
有冲突就解决后:
git add -A
git rebase --continue
- 再合并回 master(本地或平台 PR 都可)
本地合并推荐:
git switch master
git pull --ff-only origin master
git merge --ff-only feature/xxx
git push origin master
--ff-only 的好处是:只允许线性历史,能最大限度避免分叉和脏 merge。
你这次分岔的根因 你的本地 master 没先追上远端 master(远端有新提交),然后直接 merge/push,导致出现两个方向的提交历史。
三条硬规则(记住就行)
- 不在落后状态的 master 上开发。
- 合并前一定
fetch + rebase origin/master。 - 推 master 前先
pull --ff-only,失败就先处理,不要强推。
如果你愿意,我可以给你一份适配你仓库的 Git alias(如 gsync, gstart, gfinish),以后 3 条命令就走完整流程。