git操作
git init
git clone /path/to/repository
your local repository consists of three "trees" maintained by git. the first one is your Working Directory
which holds the actual files.
the second one is the Index
which acts as a staging area and finally the HEAD
which points to the last commit you've made.
git add <filename>
git commit -m "Commit message"
Now the file is committed to the HEAD, but not in your remote repository yet.
git push origin master
send those changes to your remote repository
Branches are used to develop features isolated from each other. The master branch is the "default" branch when you create a repository.
Use other branches for development and merge them back to the master branch upon completion.
git fetch
git branch
git checkout -b feature_x
git pull
update your local repository to the newest commit
git merge branch2
merge another branch into your active branch
===========================================================
merge时,切到你的开发分支,然后在merge别的分支。
Step 1. 执行fetch操作, 并将合并的目标分支检出到本地
git fetch origin
git checkout -b releases/branch origin/releases/branch111
Step 2. 使用版本号进行合并, 将出现的冲突一一解决, 并进行commit
git merge --no-ff xxxxxxx
--no-ff
指的是强行关闭fast-forward方式。
fast-forward方式就是当条件允许的时候,git直接把HEAD指针指向合并分支的头,完成合并。属于“快进方式”,不过这种情况如果删除分支,则会丢失分支信息。因为在这个过程中没有创建commit
--no-ff
:不使用fast-forward方式合并,保留分支的commit历史--squash
:使用squash方式合并,把多次分支commit历史压缩为一次
如果遇到冲突,在idea中,可以比对冲突代码,解决后再push
Step 3. 将release分支push到gitlab上
git push origin releases/branch
参考文章
http://rogerdudler.github.io/git-guide/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南