Getting started with Git

Source: Internet
Author: User

Getting started with Git

In an environment where git is so popular, if you do not have any in-depth research on git, I am embarrassed to say that I am working on the front-end. Let's go to git together.

I. Daily Work backup

Imagine if one day your hard disk suddenly breaks down, will the hard work on it survive? If not, how annoying it is. How can we prevent disasters and prevent a basket of eggs from being destroyed once? Let's go into git together and ensure the fruits of our hard work.

As shown in, each part of the work is completed through git add. submit it with git commit once. Before getting off work every day, I will use the git push command to push my local git repository to the git server, which is equivalent to step 1. Because the company's git server and the remote git data center have established an image, every time I execute a push engineer, it will automatically trigger the image operation from the Intranet server to the internet server, this is equivalent to step 2.

Ii. asynchronous collaboration

Several people may develop a project at the same time, or one person may modify a project on different hosts, which will form asynchronous collaboration. For example, if I modify a project at home and company, how can I solve this problem?

Step 3.4 shows how I work at home. First, I use step 3 to pull the image library project to a local device (a local area network is required at home). Then, after modification, submit the work to the home version library through step 4. Why do we reference the home version library? Can I directly use the mirror version library? No, because mirror is an image library and cannot be written. The command in step 3 is also very simple. You can use git pull mirror master. The command in Step 4 is git push home.

3. Modify submission instructions

Many people may find that their submission instructions are correct or understandable. In this case, you need to modify the submission instructions. You can directly use git commit -- amend in git to go to The modify commit instructions page. Here you can modify any commit instructions.

4. Regret medicine

If you submit a large image,. img. At this time, git can easily Delete the submission of this file and use git rm -- cached. img, git commit -- amend can be implemented

5. Save the work progress

If you have an urgent need to switch to a clean workspace or another branch, git provides a simple way to ensure that uncommitted work is saved.

Git stash stores the work of the current branch. git checkout new-branch switches to the new branch. After an emergency is completed, use the following command to switch back to the original command and restore the work zone.

Git checkout origin-branch

Git stash pop

 

GitHub Tutorials:

GitHub tutorials

Git tag management details

Git branch management

Git remote repository details

Git local Repository (Repository) Details

Git server setup and Client installation

Git Overview

Share practical GitHub tutorials

Git details: click here
Git: click here

This article permanently updates the link address:

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.