Git publishes code to GitHub

Source: Internet
Author: User
What is git?

1. Git is mainly used to manage versions.

2. Keep data integrity at all times: SHA-1 computing

3. Three states of the file

Submitted, modified, and saved three work areas for file transfer: local repository, git working directory, and temporary storage area. (? Linux File directory structure)

4. Common commands

Git add; git status; git config; git commit; git clone; and other common commands.

5. Install

Download EXE installation in window

Http://msysgit.github.com/

What is the use of git?

It can be used to push code to GitHub, so many other functions are useless. However, we can implement this simple function first.

According to my ideas,

1. Create a repository on GitHub.

Attention: select the last item so that you can use git clone to clone it locally.

2. Clone the repository to the local device.

Open git Bash. If you want to put the repository on the edisk, enter the command cd e:/(note that you must use a backslash to specify the directory by yourself)

Enter git clone https://github.com/Dawnminghuang/handwritten_digit.gitAnd the red part is changed to your GitHub account name and repository name.

3. Prepare the file to be uploaded and put it in the cloned. Git folder.

At this time, an additional handwritten_digit directory will be added to the E drive, and the code to push GitHub will be put here

4. Add all files in the folder to the temporary storage area.

Return to git bash and enter git add. (There is a dot indicating to put all the files in the folder into the temporary storage area.) You can check the file status and enter git status. The file is changes to be committed.

5. Submit the files in the temporary storage area to repository.

Enter git commit. The following window is displayed. Enter I (Vim insert mode) and write the description of the file (Be sure to write it; otherwise, the file cannot be submitted successfully, run the ESC key to exit insert mode. Type: WQ and save.

A prompt is displayed when the operation is successful.

6. Push the file to the remote repository.

Enter the command git push origin master (origin: Remote name, Master: local name)

You are required to enter the account name and password.

After the success, you will see your code on GitHub.

Summary:

1. Create a repository on GitHub.

2. Clone the repository to the local device.

3. Prepare the file to be uploaded and put it in the cloned. Git folder.

4. Add all files in the folder to the temporary storage area.

5. Submit the files in the temporary storage area to repository.

6. Push the file to the remote repository.

Of course, only a small part of git functions are used now, and more needs to be further studied.

References: http://pan.baidu.com/s/1eQCdkFg

Git publishes 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.