<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                分支操作可以創造另一條線的發展。對fork過程分為兩個不同的方向發展,我們可以使用此操作。例如,我們發布了6.0版本的產品,我們可能要創建一個分支,使7.0功能的發展可以保持獨立從6.0 bug修復。 ## 創建分支 使用Git分支<branch name> 命令創建新的分支。從現有的,我們可以創建一個新的分支。我們可以使用特定的提交或標簽作為一個起點。如果沒有提供任何具體的提交ID,然后分支將HEAD 創建作為一個起點。 [byron@CentOS src]$ git branch new_branch [byron@CentOS src]$ git branch * master new_branch 創建新的分支,Sampson用 git branch命令列出可用的分支。 Git會顯示星號標記之前,當前檢出的分支。 下面是創建分支操作的圖形表示 <center> ![git Tutorial](https://box.kancloud.cn/2015-12-01_565d261fa1a86.png) ![git Tutorial](https://box.kancloud.cn/2015-12-01_565d261fb3681.png) </center> ## 切換分支 Byron 使用git checkout命令到分支之間切換。 [byron@CentOS src]$ git checkout new_branch Switched to branch 'new_branch' [byron@CentOS src]$ git branch master * new_branch ## 創建和切換分支的快捷方式 在上面的例子中,我們使用了兩個命令來創建和切換分支。 Git提供checkout命令 -b選項,此操作將創建新的分支,并立即切換到新的分支。 [byron@CentOS src]$ git checkout -b test_branch Switched to a new branch 'test_branch' [byron@CentOS src]$ git branch master new_branch * test_branch ## 刪除分支 一個分支可以用git branch命令的-D選項被刪除。但在此之前,刪除現有的分支切換到其他分支。 Byron 當前在test_branch 想要刪除該分支。于是,他分支和刪除分支切換,如下圖所示。 [byron@CentOS src]$ git branch master new_branch * test_branch [byron@CentOS src]$ git checkout master Switched to branch 'master' [byron@CentOS src]$ git branch -D test_branch Deleted branch test_branch (was 5776472). 現在Git會顯示只有兩個分支。 [byron@CentOS src]$ git branch * master new_branch 重命名分支 Byron 決定添加寬字符支持他的字符串操作項目。他已經創建了一個新的分支,但分支名稱是不恰當的。于是,他通過使用-m選項,其次是舊分支名稱和新分支名稱變更分支名稱。 [byron@CentOS src]$ git branch * master new_branch [byron@CentOS src]$ git branch -m new_branch wchar_support 現在git branch命令將顯示新分支名稱。 [byron@CentOS src]$ git branch * master wchar_support ## 合并兩個分支 Byron 實現函數返回字符串的長度為寬字符串。新代碼將看起來像這樣 [byron@CentOS src]$ git branch master * wchar_support [byron@CentOS src]$ pwd /home/byron/byron_repo/project/src [byron@CentOS src]$ git diff 上面的命令會產生以下結果。 t a/src/string_operations.c b/src/string_operations.c index 8ab7f42..8fb4b00 100644 --- a/src/string_operations.c +++ b/src/string_operations.c @@ -1,4 +1,14 @@ #include <stdio.h> +#include <wchar.h> + +size_t w_strlen(const wchar_t *s) +{ + const wchar_t *p = s; + + while (*p) + ++p; + return (p - s); +} 測試后,他提交他的變化,并推到新的分支。 [byron@CentOS src]$ git status -s M string_operations.c ?? string_operations [byron@CentOS src]$ git add string_operations.c [byron@CentOS src]$ git commit -m 'Added w_strlen function to return string lenght of wchar_t string' [wchar_support 64192f9] Added w_strlen function to return string lenght of wchar_t string 1 files changed, 10 insertions(+), 0 deletions(-) 注意杰里推動這些變化的新分支,這就是為什么他用wchar_support分支的名稱,而不是master分支。 [byron@CentOS src]$ git push origin wchar_support <????????????? Observer branch_name 上面的命令會產生以下結果。 Counting objects: 7, done. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 507 bytes, done. Total 4 (delta 1), reused 0 (delta 0) To gituser@git.server.com:project.git * [new branch] wchar_support -> wchar_support 經過分支提交的變化,新分支會這個樣子。 <center> ![git Tutorial](https://box.kancloud.cn/2015-12-01_565d261fc3927.png) </center> Sampson 好奇Byron 在做什么在他的私人分支,這就是為什么他檢查日志從wchar_support 分支。 [sampson@CentOS src]$ pwd /home/sampson/top_repo/project/src [sampson@CentOS src]$ git log origin/wchar_support -2 上面的命令會產生以下結果。 commit 64192f91d7cc2bcdf3bf946dd33ece63b74184a3 Author: Byron <xiaobosun@gridinfo.com.cn> Date: Wed Sep 11 16:10:06 2015 +0530 Added w_strlen function to return string lenght of wchar_t string commit 577647211ed44fe2ae479427a0668a4f12ed71a1 Author: Sampson <sampson@12xue.com> Date: Wed Sep 11 10:21:20 2015 +0530 Removed executable binary 通過查看提交的信息,Sampson 意識到Byron 實現寬字符strlen 函數,他希望同樣的功能集成到主分支。而不是重新實現他的分支合并到主分支,他決定采用Byron的代碼。 [sampson@CentOS project]$ git branch * master [sampson@CentOS project]$ pwd /home/sampson/top_repo/project [sampson@CentOS project]$ git merge origin/wchar_support Updating 5776472..64192f9 Fast-forward src/string_operations.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) 合并操作后的主分支會這個樣子。 <center> ![git Tutorial](https://box.kancloud.cn/2015-12-01_565d261fd4931.png) </center> 現在wchar_support分支合并到主分支中我們可以驗證它的查看提交信息,通過查看修改成string_operation.c文件。 [sampson@CentOS project]$ cd src/ [sampson@CentOS src]$ git log -1 commit 64192f91d7cc2bcdf3bf946dd33ece63b74184a3 Author: Byron Mouse Date: Wed Sep 11 16:10:06 2015 +0530 Added w_strlen function to return string lenght of wchar_t string [sampson@CentOS src]$ head -12 string_operations.c 上面的命令會產生以下結果。 #include <stdio.h> #include <wchar.h> size_t w_strlen(const wchar_t *s) { const wchar_t *p = s; while (*p) ++p; return (p - s); } 經過測試,他把他的代碼更改到主分支。 [sampson@CentOS src]$ git push origin master Total 0 (delta 0), reused 0 (delta 0) To gituser@git.server.com:project.git 5776472..64192f9 master ?> master ## 重訂分支 Git 的 rebase命令的一個分支合并的命令,但不同的是,它修改提交的順序。 Git merge命令,試圖把從其他分支提交當前的本地分支的HEAD上。例如 本地的分支已經提交A-> B-> C-> D和合并分支已提交A-> B-> X> Y,則Git合并將當前轉換像這樣的本地分行A-> B-> C-> D-> X-> Y Git 的rebase命令試圖找到當前的本地分支和合并分支之間的共同祖先。然后把修改提交的順序,在當前的本地分支提交中的本地分支。例如,如果當地的分支已提交A-> B-> C-> D和合并分支已提交A-> B-> X-> Y,Git衍合的類似A-> B轉換成當前的本地分支A?>B?>X?>Y?>C?>D 當多個開發人員在一個單一的遠程資源庫的工作,你不能在遠程倉庫提交修改訂單。在這種情況下,可以使用變基操作把本地提交的遠程倉庫之上的提交,可以推送這些變化。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看