GitHub and GitHub for Windows Learning Usage Summary

Source: Internet
Author: User

GitHub is the largest open source project hosting platform and is a Web site. But it is not only to host open source projects or code, but also as a platform for us to back up important information, more importantly, we can learn and acquire other people's code through this platform, avoid repeating the wheel, but also can work together more people. Git's command line is still learning, and I'm using a Windows system that uses GitHub for Windows to handle most of the backup requirements and other transactional processes in our daily lives.

Using GitHub for Windows

First, prepare

Step 1: Register your GitHub account

Open the GitHub website https://github.com, then fill in the user name, email address, password

Step 2: Download and install the GitHub for Windows client

Download the client https://git-scm.com/downloads, will download an executable file, and then select the executable file to continue to download, may be downloaded many times unsuccessful, after all, is a foreign server, unstable and slow is normal, try a few more. This icon is available on the desktop after the installation is complete:

Second, backup

Step 1: Create a new warehouse

Go to the GitHub website to create a new warehouse. Each person on GitHub's project is a warehouse (repository). Each person's account under the name of the warehouse is not the same, even if it is with the other people's warehouse names do not matter. Here is an example of the next step, taking the data from my running record.

Once the login is successful, you can see our user name:

To create a new warehouse:

Step 2: Start client, login account

Start the GitHub for Windows client and log in to your account:

Once saved, the project owner and Project submitter are selected. We can then clone the project locally and borrow our familiar editing tools locally to back up to the GitHub site.

Step 3: Cloning a project

To bring the newly created warehouse to the Local:

Click "Open in Desktop" will start the client, then we select the local saved path, select OK, then start cloning:

After cloning, the Readme file and the. git folder will be added under our chosen path:

Step 4: Process (add and revise) local files

Add a new file to your local----run details. xlsx, fill in the running details and save after completion. Such a process completes a modification of the local file.

Step 5: Submit the file to staging area

After the workspace is finished, we need to submit the file to staging area:

Under the changes column, you can see the files we have changed, whether it is new, modified, deleted have traces to find. Select the file you want to submit to staging area. If found wrong, regret submitted, you can perform "Undo" action, this submission is void, continue to change the file locally until satisfied:

Step 6: Sync files to GitHub

Only after synchronizing the files to GitHub can someone else see the file, so that the changes are added, the Fork warehouse provides comments, the pull request is pulled, and the merge (merge) and so on. Click "Sync" to sync.

At this point, our file backup work is complete. The most up-to-the-minute modifications and additions to the file are repeated, and the step 4-step 6 is complete.

Step 7: Duplicate backup work

Repeat the backup work to prepare for the branching narrative. Add a text document under the local running folder----running term,. txt, as follows:

Then commit and sync to GitHub.

Third, Branch

1. Create a new branch

Suppose a scene, the running term above, I add a few more daily as I accumulate English words. But later I found that the explanation for the pace was not clear enough, and I wanted to add some explanatory examples. Now I can create a new branch to add explanations. To create a example branch:

Add an example note after the pace term:

2. Submit the current Branch

Commits the current branch and synchronizes it to GitHub.

3. Merging of two branches

There are two ways to merge two branches:

(1). Merging via GitHub website (recommended):

This approach is simpler and easier to understand. After synchronizing the example branch to the GitHub site, you'll see a hint on the Web site that "there are new branches available for comparison and pull requirements":

Click on "Compare & Pull Request" To select the Compare object and Create Pull request:

If the base branch and compare branches are selected incorrectly, you can select them manually. Select the Create pull request to drag the contents of the example branch into the Master branch. Then merge the branches:

At this point our branch merge operation is complete. You can see the contents of the master branch from the GitHub website:

If the merge succeeds, then the example branch is not needed, and its task is completed and can be deleted:

Click "2 Branchs" to display the specific branch and operate the branch:

Then "2 Branchs" becomes "1 branch", deleting the branch succeeds.

(2). Merging via GitHub for Windows client

Create a new branch example2 to demonstrate the merging of branch operations with GitHub for Windows clients. To create a new branch, modify a local file, commit, publish, and so on, the client branch will appear as follows:

You need to change the current branch, Example2-->master, and then turn the branch used for comparison into Example2,master-->example2:

Then click "Update from Example2" to see the word "merge" from the history, stating that it has been merged:

Finally click "Sync" to sync the merge to GitHub.

Delete the Example2 branch and delete the branch can also be done on the client:

Four, fork

There's a scene where people see my running term one of the descriptions is incorrect and he wants to change it. So I can add him to the contributors, we happily cooperate, but it is too dangerous, we do not know, he changed the wrong how to do? I think we can communicate before he changes, I can also check his change, and then decide whether to take his changes. Now you can use the fork, my understanding fork = clone + update + sync (commit) + merge (pull request).

1. Clone

Classmate A (lixinjie1992) login to his account, see my running terminology, feel curious, open a look think somewhere need to change. So he fork and clone into his own account:

Click Fork to clone a copy of the warehouse to your account:

If the change is smaller, it's plain text editing, and it's quicker to edit directly on the GitHub website:

2. Update

Click on the file you want to modify, go to the text editor, then fill in the change instructions, then submit:

3. Commit

4. Pull request pulls once:

Compared to the previous change:

Create pull request, waiting for the warehouse owner to reply:

After some time, classmate B found pull request here is a message:

Click View, and then click on the changed file, you can select and give the classmate A message to thank him, or not and give him a message indicating the reasons for not merging:

The final "Confirm merge" confirms the merger.

If the change is relatively large, you need to clone the project to your own computer, in the work area after the commit (commit), Sync (sync), and then (pull request). The remaining steps are similar to the above.

Five, many people work together

By adding other people's accounts into the collaborators, you can collaborate. Take classmate B's running as an example, add classmate A, used to work in collaboration with many people:

Running-->contributor-->settings-->collaborators:

Added into the collaborators, the biggest difference is that no longer through classmate B agreed, classmate A can directly participate in the modification of running and merge work.

GitHub and GitHub for Windows Learning Usage Summary

Related Article

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.