Use of Git Gui

Source: Internet
Author: User
Tags using git github mac

Use of Git Gui
GuideIf you have learned a lot about using Git command line operations. You have learned to operate on local files, connect to your repository through the network, and cooperate efficiently with others. But the story is not over yet; Git is usually part of a larger ecosystem, and in some cases terminal usage is not the most appropriate method. Now let's take a look at how to better use Git in other types of environments and how other applications (including yours) can collaborate with Git.

Graphic Interface

The native environment of Git is a terminal. There, you can experience the latest features, and only in there can you make full use of Git's capabilities. However, for some tasks, plain text is not the best choice. Sometimes you really need a visual display method, and some users prefer the interface that can be clicked.

Note that different interfaces are designed for different workflows. In order to support a workflow that he thinks is efficient, some Client authors carefully select and only display a subset of Git functions. Each tool has a specific purpose and significance. From this perspective, it cannot be said that a tool is "better" than other tools ". Note that there is nothing the GUI client can do but the command line client cannot do. The command line is always where you can fully control the warehouse concurrency and exert all the power.

Gitk and git-gui

You have installed the visualization tools gitk and Git-gui provided by git.

Gitk is a graphical viewer of historical records. You can use it as a powerful graphical operation interface based on git log and git grep commands, you will use this tool when you need to find a previous record or visually view the project history.

The simplest way to use Gitk is to open it from the command line, just cd to a Git repository, and then type:

$ gitk [git log options]

Gitk can accept many command line options, most of which are directly transferred to the underlying git log for execution. -- All may be one of the most useful ones. It tells gitk to submit and display from any reference search as much as possible, not just from HEAD, Gitk's interface looks like this

Gitk history Viewer

This figure looks similar to the output of running the git log-graph command. Each vertex represents a commit, and the line represents the parent-child relationship, while the colored squares are used to indicate references one by one. Yellow points indicate HEAD, and red points indicate local changes that have not been submitted. The window below shows the details of the selected submission. Comments and patches are displayed on the left and summary on the right. In the middle is a group of controls used to search for history.

In comparison, git-gui is mainly a tool used to make the submission. The simplest way to open it is to start it from the command line:

$ git gui

Its interface looks like this:

Git-gui Submission Tool

On the left side is the index area. unsaved changes are shown above, and temporary changes are shown below. You can click the icon on the left side of the file name to switch the file between the Saved state and the unsaved state. You can also select a file name to view its details.

In diff format, the upper part of the window on the right shows the changes to the selected file. You can right-click a block or row to place the block or row in the temporary storage area.

At the bottom of the window on the right is the place where logs are written and operations are executed. In the text box, type the log and click Submit, which is similar to running git commit. If you want to submit the last revision, select the "revision" button. The last submitted content will be displayed in the "temporary storage area ". Then you can save and cancel the temporary modification, update the submission log, and click submit again to overwrite the previous submission.

Gitk and git-gui are two examples of tools designed for a specific task. They are simplified for different purposes (I .e. Viewing History and production submission, the unused features are omitted.

GitHub client on Mac and Windows

GitHub released two workflow-oriented Git clients: Windows and Mac. They demonstrate what a workflow-oriented tool should look like-focusing on improving the availability of common features and their collaboration, rather than implementing all of Git's features, they look like this:

GitHub Mac client

GitHub Windows Client

We try to make the two products have the same appearance and operation experience during the design. Therefore, we will introduce them as the same product in this chapter. We will not detail every function of the tool (because they also have documentation ), but please take a quick look at the following points in the "change" window (which you will spend most of your time using:

  • The left side is the list of repositories being tracked. by clicking the "+" icon in the upper left corner, you can add a repository to be tracked (either through clone or local addition ).
  • In the Input-submit area, you can enter the submit log here and select the files to be submitted. (In Windows, the submission history is displayed below this region; on Mac, there is a separate window for the Submission History)
  • On the right side is the modify view area, which will tell you which items in the working directory have been modified or which modifications are included in the selected submission: historical mode ).
  • The last thing you need to be familiar with is the "Sync" button in the upper-right corner. You mainly use this button for network interaction.

NOTE: you do not need to register a GitHub account or use these tools. Although they are designed according to the GitHub recommendation workflow and highlight some of the GitHub service experience, they can work well on any Git repository, you can also connect to any Git host over the network.

Install

GitHub's Windows client can be downloaded from the https://windows.github.com, Mac client can be downloaded from the https://mac.github.com. When you open the software for the first time, it will guide you through a series of first-time usage settings, such as setting your name and email, and it will help you intelligently adjust some common default settings, for example, how to handle the credential cache and CRLF.

They are all "green software"-If the software is opened and an update is found, the download and installation of the upgrade package are completed in the background. For convenience, they also package a copy of Git, that is to say, once installed, you no longer have to worry about upgrading. Windows clients also provide shortcuts to start Powershell with the Posh-git plug-in installed. We will introduce this content in detail in later sections of this chapter.

Next we will set up some work warehouses for it. The client will display a list of repositories that you have permissions to operate on GitHub. You can select one and then clone it with one click. If you have already created a repository locally, drag it from the Finder or Windows Resource Manager to the GitHub client window, and you can add the repository to the repository list on the left.

Recommended Workflow

After installation and configuration, you can use the GitHub client to execute some common Git tasks. The workflow recommended by this tool is sometimes called "GitHub stream ". We will provide a detailed description of this in the GitHub Process Section. The main point is (a) You will submit it to a branch; (B) You need to always synchronize with the remote repository.

The clients on the two platforms differ in branch management. On Mac, the create branch button is at the top of the window:

Create branch button on Mac

On Windows, you can create a new branch by entering the name of the new branch in the branch switch pendant:

Create a branch on Windows

After the branch is created, it becomes very simple and straightforward to create and submit. Now make some changes in the working directory and switch to the GitHub client window. The changes will be displayed there. Enter the submit log, select the files that need to be included in this commit, and then click the "Submit" button (you can also press ctrl-enter or submit-enter on the keyboard ).

The "synchronization" function is the main way for you to interact with other warehouses on the network. Push, fetch, merge, and rebase are a series of independent operations within Git, And the GitHub client combines these operations into a separate function. The following operations are actually performed when you click the synchronize button:

  • Git pull -- rebase. If the preceding command fails due to a merge conflict, git pull -- no-rebase will be executed.
  • Git push.

If you follow the recommended workflow, the above are the most commonly used commands, so merging them into one makes things much easier.

Summary

These tools are tailored to their respective workflows. Developers and non-developers can easily build a project collaboration environment within minutes, they also provide other features that assist with best practices. However, if your workflow is different or you need more control during network operations, you are advised to consider other clients or use command lines.

Other graphic interfaces

In addition, there are many other graphical Git clients, including single-function custom tools and complex applications that try to provide all Git functions. The official Git website provides a list of the most popular clients today: http://git-scm.com/downloads/guis. You can also see a more comprehensive list https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools#Graphical_Interfaces on the Git wiki site

Original article: https://git-scm.com/book/zh/v2/the -git-graphic interface in its own environment

Address: http://www.linuxprobe.com/git-view.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.