GitKraken usage tutorial - basic part (7)

8. Local branches and tags

1) View the branch status in the commit record area

Each branch in the commit record area is located on a commit record line.

As can be seen from Figure 2-1, the master branch on the server stays at the commit record in the sorting format (record this commit record as origin_master_HEAD),

In the local master branch (record the commit record where the master branch is located as master_HEAD), change the 19264.h file encoding to utf8.

Then a new branch was created from origin_master_HEAD: testconflict, the two files Chip_ADC.h and 19264.h were modified, and the commit record here was recorded as test_HEAD.

Figure 2-1 Schematic diagram of submission record

2) Create a local branch

Right-click on the commit record in the central area of ​​GitKraken, and the drop-down menu as shown below appears:

Figure 2-2 Right-click drop-down menu

Click Create branch here and you will be prompted for the branch name (enter branch name in the figure below)

Figure 2-3 Create a new local branch

Here the new branch is named testnewbranch. Once confirmed, a new branch will be created at the current commit record. The branch testnewbranch will appear in the LOCAL menu on the left side of the program, as shown below:

Figure 2-4 Local branch list

After creating a new branch, the program will automatically jump to the newly created branch.

3) Switch the local branch

There are three local branches master, testconflict and testnewbranch in Figure 2‑5 (the current version branch is testnewbranch, and the tick on the left indicates that this branch is the current branch):

Figure 2-5 Local branch list

To switch to another branch (eg switch to the master branch), there are several ways:

a) Move the mouse to the column where the master branch is located, click the button on the right (the button circled by the red box), or right-click the column,

The drop-down menu as shown below appears, click Checkout master to switch to the branch master.

Figure 2-6 Menu for switching branches

b) Double-click the branch directly in the local branch list to switch to this branch

4) Delete or rename the local branch

Right-click a branch in the branch list, take testnewbranch as an example,

Figure 2-7 Branch drop-down menu

Click Rename testnewbranch, and a prompt appears at the top of the program:

Figure 2-8 Modify the branch name

Fill in the new name, such as "renamedbranch", after filling in, click the Submit button. The branch name in the local branch list will be changed accordingly. It should be noted that the changed branch name cannot be the same as the existing branch name.

If you click Delete testnewbranch, similarly, a prompt will appear at the top of the program:

Clicking the Delete button will delete the branch locally.

5) Focus on branches and the paths they are on

Right-click on the local branch or remote branch and select the Hide item in the drop-down menu bar to hide the branch in the central commit record area. Take hiding the testconflict branch as an example, you can see the mark on the left side of the testconflict branch in the local branch list Turns gray (as shown in Figure 2‑10):

Figure 2-9 Branch drop-down menu

Figure 2-10 Local branch

Clicking on the Solo item in the menu will display only this branch.

6) Tags (TAGS)

TAGS represents the tags that exist in the current workspace.

Figure 2-11 Push the label to the server

Right-click on the commit record in the central area of ​​GitKraken, and the menu shown in the figure below appears. Click to create a local tag at the current commit record.

Figure 2-12 Create label

It should be noted here that after TAG is marked locally, it will not be automatically synchronized to the server when uploading the code. You must select the tag under the TAGS tag, right-click and push the TAG to the server (origin) before it can be shared (as shown in Figure 2-11).

(If you need to upload all local tags to the server,

Use the command git push --tags in the command line or terminal to upload all local tags to the server. )

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325879582&siteId=291194637
Recommended