参考自geekHour教程
基本操作
使用git init 创建一个仓库
可以指定名称
git status 查看仓库的状态
git add 添加到暂存区
可以使用通配符,例如:git add*,txt
也可以使用目录,例如:git add
git commit 提交
只提交暂存区中的内容,不会提交工作区中的内容
git commit -a -m
-a表示一次完成提交到暂存区 和 仓库
-m后跟提交标题内容
git log 查看仓库提交历史记录
可以使用-oneline参数来查看简洁的提交记录
git reset
| 命令 | 工作区 | 暂存区 | 作用 |
|---|---|---|---|
| git reset –soft | √ | √ | 正常回退,保存本地工作区和暂存区 |
| git reset –hard | 适用于完全放弃之前的修改 <br>丢弃工作区和暂存区文件 | ||
| git reset –mixed | √ | reset默认的级别 与soft区别是<br>回退后要手动git add |
git diff
git diff 默认比较工作区和暂存区之间的差异
使用git add命令可以添加到暂存区
git diff HEAD 比较工作区和版本库之间的差异
git diff –cache 比较缓存区(暂存区)和版本库
使用git commit 提交后消除差异
git diff id id 比较两个版本差异
git diff head~ head比较当前版本和上一个版本之间的差异

git rm
使用Linux命令或Windows操作删除工作区的文件
但是使用git ls-files 查看暂存区内容发现还是存在的
使用git add 更新暂存区
git rm 文件名
会直接删除工作区和暂存区的内容

远程仓库
git clone 地址 实现克隆仓库
使用时应当配置ssh秘钥,回到用户根目录建立 . ssh文件 并执行ssh-keygen -t rsa -b 4096
可在github设置ssh公钥
git push 推送到远程仓库
git pull 拉取到本地仓库


分支
git branch 查看所有分支
git branch 名称 新建分支
git checkout 名称 切换分支、恢复文件
git Switch 名称
dev开发分支 main主分支
将dev分支的操作合并到main中
要先切到 main :git Switch main,再使用<font color="#00b0f0">git merge dev合并</font>
合并后,如果不再需要dev分支 使用<font color="#00b0f0"> git branch -d dev 删除合并后的分支</font>
使用<font color="#00b0f0"> git branch -D dev 强制删除分支</font>

解决合并冲突
比如修改同一文件的同一行数据,dev 和 main 进行分别提交后会产生分歧
再执行 git merge dev 后,会提示合并失败,需要手动解决合并冲突
使用git status 查看冲突文件列表
使用git diff 命令查看具体冲突内容
需要手动编辑对应的内容,解决冲突后再进行提交
回退和rebase(变基)


使用git checkout -b dev id 切换到指定分支的某次提交
Merge
优点:不会破坏原分支的提交历史,方便回溯和查看。
缺点:会产生额外的提交节点,分支图比较复杂。
Rebase
优点:不会新增额外的提交记录,形成线性历史,比较直观和干净;
缺点:会改变提交历史,改变了当前分支branch out的节点。避免在共享分支使用。








Honestly, the probability side of this is tricky. For beginners, understanding the odds is key! Makes me think about 789 casino slot odds. Seems straightforward enough, but details matter.
Seriously, navigating these sites is a headache! Glad you mentioned strategy; that’s what I need more than random tapping. Check out phkkk apk for an easier entry point!
It’s fascinating how gaming platforms like vip555nw apk use data to personalize experiences! Understanding user behavior is key – it’s not just about the games, but how they’re presented. Really interesting stuff about KYC too, security is vital. 🤔
Hmm, the risk control aspect they mention is key! It’s not just flashy graphics; the structure matters. Check out 33win56 game for a more robust look. Fascinating how much thought goes into safety protocols!
Understanding the nuance between merge and rebase is key; it’s not just code, but project history management. This discipline of tracking divergent paths and resolving conflicts is universally valuable, whether managing a software codebase or the complex operations of a platform like phgames online casino. Excellent deep dive!
Solid article! Understanding player psychology is HUGE in tournaments. Seeing platforms like 68win app download focus on engagement-like streamlined onboarding-shows they get retention. Key for long-term success!