分支的作用 #6

Open
opened 2023-12-12 15:48:25 +08:00 by suneshone · 1 comment
Owner

让我们来看一个简单的分支新建与分支合并的例子,实际工作中你可能会用到类似的工作流。 你将经历如下步骤:

  1. 开发某个网站。
  2. 为实现某个新的用户需求,创建一个分支。
  3. 在这个分支上开展工作。

正在此时,你突然接到一个电话说有个很严重的问题需要紧急修补。 你将按照如下方式来处理:

  1. 切换到你的线上分支(production branch)。
  2. 为这个紧急任务新建一个分支,并在其中修复它。
  3. 在测试通过之后,切换回线上分支,然后合并这个修补分支,最后将改动推送到线上分支。
  4. 切换回你最初工作的分支上,继续工作。

分支切换会改变你工作目录中的文件

让我们来看一个简单的分支新建与分支合并的例子,实际工作中你可能会用到类似的工作流。 你将经历如下步骤: 1. 开发某个网站。 2. 为实现某个新的用户需求,创建一个分支。 3. 在这个分支上开展工作。 正在此时,你突然接到一个电话说有个很严重的问题需要紧急修补。 你将按照如下方式来处理: 1. 切换到你的线上分支(production branch)。 2. 为这个紧急任务新建一个分支,并在其中修复它。 3. 在测试通过之后,切换回线上分支,然后合并这个修补分支,最后将改动推送到线上分支。 4. 切换回你最初工作的分支上,继续工作。 分支切换会改变你工作目录中的文件
suneshone added the
question
label 2023-12-12 15:48:25 +08:00
suneshone self-assigned this 2023-12-12 15:48:25 +08:00
suneshone added this to the 学习git的使用 project 2023-12-12 15:48:25 +08:00
suneshone added the due date 2023-12-15 2023-12-12 16:03:54 +08:00
suneshone started working 2023-12-12 16:04:04 +08:00
Author
Owner

git branch <branchname> 创建分支
git branch -d <branchname> 删除分支
git checkout <branchname> 切换分支

创建新分支的同时切换过去,通常我们会在创建一个新分支后立即切换过去,这可以用 git checkout -b <newbranchname> 一条命令搞定。

#7

`git branch <branchname>` 创建分支 `git branch -d <branchname>` 删除分支 `git checkout <branchname>` 切换分支 创建新分支的同时切换过去,通常我们会在创建一个新分支后立即切换过去,这可以用 `git checkout -b <newbranchname>` 一条命令搞定。 #7
suneshone stopped working 2023-12-12 16:48:27 +08:00
44 minutes 23 seconds
suneshone started working 2023-12-12 16:49:54 +08:00
suneshone added a new dependency 2023-12-12 17:01:46 +08:00
suneshone removed a dependency 2023-12-12 17:04:42 +08:00
suneshone pinned this 2023-12-12 17:06:04 +08:00
suneshone stopped working 2023-12-13 09:20:15 +08:00
16 hours 30 minutes
suneshone deleted spent time 2023-12-13 09:20:33 +08:00
- 16 hours 30 minutes
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Total Time Spent: 44 minutes 23 seconds
suneshone
44 minutes 23 seconds
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

2023-12-15

Dependencies

No dependencies set.

Reference: suneshone/obscuredSubtitles#6
No description provided.