日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

git 颜色扩展_GIT:扩展

發布時間:2024/3/12 编程问答 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 git 颜色扩展_GIT:扩展 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

git 顏色擴展

Nearly every VCS has some form of branching support. Branching means, you diverge from the main line of development and continue to do work without messing with that main line. In many VCS tools, this is a somewhat expensive process, often requiring you to create a new copy of your source code directory, which can take a long time for large projects.

幾乎每個VCS都具有某種形式的分支支持。 Branching意味著,您脫離了開發的主線,并且繼續進行工作而不會弄亂主線。 在許多VCS工具中,這是一個比較昂貴的過程,通常需要您創建源代碼目錄的新副本,這對于大型項目可能會花費很長時間。

Consider a tree for example. A tree always has some branches along with the large trunk. Similarly, branches in Git are smaller parts of the project which need not interfere with the main branch (recall master). They have their own commits and are added to master once they are completed. The master branch is like the trunk of a tree. In most cases, the code contained in the master branch is usually the one being deployed.

考慮一棵樹。 一棵樹總是與大樹干一起有一些樹枝。 同樣,Git中的分支是項目的較小部分,不需要干擾主分支(調用主分支)。 它們具有自己的提交,并在完成后被添加到母版中。 主分支就像一棵樹的樹干。 在大多數情況下,master分支中包含的代碼通常是正在部署的代碼。

Some people refer to Git's branching model as its "killer feature", and it certainly lets Git apart in the VCS community. Why is it so special? Git branches are incredibly lightweight, making branching operations nearly instantaneous, and switching back and forth between branches generally just as fast. Unlike many other VCSs, Git encourages workflows that branch and merge often, even multiple times in a day. Understanding and mastering this feature gives you a powerful and unique tool and can entirely change the way that you develop.

有人將Git的分支模型稱為其"killer feature" ,它肯定會使Git在VCS社區中脫穎而出。 為什么這么特別? Git分支非常輕巧,幾乎可以立即進行分支操作,并且在分支之間來回切換的速度通常一樣快。 與許多其他VCS不同,Git鼓勵工作流經常分支和合并,甚至在一天內多次。 了解和掌握此功能可以為您提供強大而獨特的工具,并且可以完全改變您的開發方式。

Let's consider that our awesome_project is based on a Web Development Project. You are currently on the master branch and it's going great, but you need to add a sign-in feature to your project. Now you certainly don't want this code to mess with your current code, do you? So let's give the feature its own branch. You create a new branch by using git branch command. Check the status of the repository to make sure you don't have anything to commit.

讓我們考慮一下我們的awesome_project基于Web開發項目。 您目前位于master分支上,并且進展順利,但是您需要在項目中添加登錄功能。 現在您當然不希望此代碼與您當前的代碼混淆,是嗎? 因此,讓我們為功能提供自己的分支。 您可以使用git branch命令創建一個新分支。 檢查存儲庫的狀態,以確保您沒有要提交的任何內容。

Name the new branch signin_feature: $ git branch signin_feature

將新分支命名$ git branch signin_feature signin_feature: $ git branch signin_feature

Check the status again. Hmm, we're still on the master branch. How do we switch to our new branch? Remember our friend from before, git checkout? This command can be used to switch between branches. When you don't provide it with a hash value, Git assumes that you want to switch to a branch. Go on and switch to the new branch we just created and check the status just to be sure.

再次檢查狀態。 嗯,我們仍在master分支上。 我們如何切換到新分支? 還記得我們以前的朋友, git checkout嗎? 此命令可用于在分支之間切換。 當您不為其提供哈希值時,Git會假定您要切換到分支。 繼續并切換到我們剛剛創建的新分支,并檢查狀態以確保。

$ git checkout signin_feature

Go ahead and make a new file, file4 in this case and commit it. After you have successfully committed it, check the log. Certainly, you see the entry of the new commit sitting there.

繼續創建一個新文件,在這種情況下為file4并提交。 成功提交后,請檢查日志。 當然,您會看到坐在那里的新提交的條目。

Let's switch back to master and view the log again. Uh-oh. The commit is missing. Did we erase it? Don't worry the commit is still there. Git is smart enough to know that this commit was in the signin_feature branch and the master branch has nothing to do with it yet.

讓我們切換回master并再次查看日志。 哦哦 提交丟失。 我們刪除了嗎? 不用擔心提交仍然存在。 Git非常聰明,知道此提交位于signin_feature分支中,而master分支與此無關。

Keep in mind that whenever you branch out, the new branch is a copy of the current branch you are on. As of now, we branched out from the master, hence all master commits were available in the log.

請記住,每當分支出去時,新分支就是您所在的當前分支的副本。 到目前為止,我們已經從主服務器分支出來,因此所有主服務器提交在日志中都可用。

There is another way you can create a new branch. Our friend, git checkout helps us bypass the branch command entirely. Go on and type the following at your command line. Let's create a new subscription feature:

還有另一種創建新分支的方法。 我們的朋友git checkout幫助我們完全繞過了分支命令。 繼續,在命令行中鍵入以下內容。 讓我們創建一個新的訂閱功能:

$ git checkout -b subs_feature

The -b option lets you create a branch and switch to it all in one single command.

使用-b選項 ,您可以創建一個分支并在一個命令中將其全部切換到該分支。

Now that we've created some branches let's learn more about managing them. We have a total of 3 branches right now, but larger projects have hundreds or even thousands of branches. How do we keep track on which branches exist?

現在我們已經創建了一些分支,讓我們進一步了解如何管理它們。 現在我們總共有3個分支,但是較大的項目有數百個甚至數千個分支。 我們如何跟蹤存在的分支?

Git lets us view all the branches in the repository by using the 'git branch' command:

Git讓我們使用'git branch'命令查看存儲庫中的所有分支:

$ git branch

This will give you a list of all branches along with your current branch. Let's say we decide to skip the subscription feature and delete it. Not every one of your ideas can get to the final project.

這將為您提供所有分支以及當前分支的列表。 假設我們決定跳過訂閱功能并刪除它。 并非您的每個想法都可以進入最終項目。

You can use the -D option in the branch command to delete your branch:

您可以在branch命令中使用-D選項刪除您的分支:

$git branch -D subs_feature

Oops! We can't delete the branch we are currently working in. Switch back to master and try again.

糟糕! 我們無法刪除當前正在使用的分支。切換回master,然后重試。

Phew! This was a long one. Good work. You deserve a cookie! Next up, we look into merging. What does that mean? Read on...

! 這是一個很長的時間。 辛苦了 你應該得到一個餅干! 接下來,我們考慮合并。 那是什么意思? 繼續閱讀...

翻譯自: https://www.studytonight.com/github/branching-in-git

git 顏色擴展

總結

以上是生活随笔為你收集整理的git 颜色扩展_GIT:扩展的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。