Learn Git's tips and how to upload locally modified, deleted code to GitHub

Source: Internet
Author: User
Tags git commands

A: Learn about the GitHub information as follows:https://git.oschina.net/progit/

This is a Chinese language learning git website, if you can calm down to read, do not require too much reading, just read the first three chapters, you can grasp the common git commands.

Two: Learn the problem of remote repository in git:

Git remote repository: That's where you manage your code, and this is what GitHub offers, as long as you register on GitHub you can get an unlimited git remote repository.

The remote repositories in my GitHub are as follows:

To the remote repository I first understand that: in Gitbash a command: Git init generates a hidden file. Git is a remote repository, in fact, he is a local git repository, if you want him to associate with a remote repository, just enter the command

Git remote add origin url (this URL is the URL of the remote repository that your GitHub provides to you):

For example, if you want a local repository and want to associate the full command with my remote repository: Git remote add Origin https://github.com/qinlinsen/spring.git

I don't know if the remote repository is registered on GitHub at the time, I think my remote warehouse is not I want to be in a LAN with a computer as a server, the result is still wrong, until I found that GitHub after registration will be a remote warehouse, The advent of this remote repository gave me a great deal of help in reading the material https://git.oschina.net/progit/provided above.

So I recommend that you first register with GitHub before you learn some git commands to get a remote repository.

Three: How to use the idea development tool to upload your own project to GitHub.

The steps are as follows:

Click: File----Settings

or press the shortcut key directly: Ctrl+alt+s

Tap the circle to share the item in GitHub.

Follow the three charts above: You can share the project on GitHub.

Four: Solve the question raised by the title: How to upload locally modified, deleted code to GitHub

The answers are as follows:

The following commands are entered in the Gitbash.

1. Get the directory to the top-level directory of your local repository (. git):

$ cd/f/mygithubproject/spring/

The figure is as follows:

2. Create a new branch Sixi and switch to that branch:

$git Checkout-b Sixi

3. In the branch can modify the code, delete, increase and so on.

4. Commit Sixi This branch to modify, delete, add the code:

$ git commit-a-m ' Commit all Files '

5. Switch to the Master branch and merge the branch Sixi into master.

$git Checkout Master

$git Merge Sixi

6. Upload to the remote repository:

Git push Origin Master

Description: Origin is the name of the remote repository. Master is a branch of the remote repository.

Finally, we must look at the above mentioned information:https://git.oschina.net/progit/

This is necessary for everyone to understand the principle of git.

Learn Git's tips and how to upload locally modified, deleted code to GitHub

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.