Git workflow and initial operation

Source: Internet
Author: User
Tags git workflow i18n

 

 

Run the GIT add command to submit the workspace file to the temporary storage area.

View the File status in git status

Git commit-M "Submit description" to submit the files in the staging area to the repository

Use git to try the operation

Right-click the location where you want to create repository and select git Bash here

Here I have encountered a problem, and it is a crash.

Cause C: the null. SYS file in \ windows \ system32 \ drivers is damaged. Replace the available null. SYS file. Run the SC start NULL command line as the administrator.

Link: https://pan.baidu.com/s/1WsJ3YL-8SJtsXNumMQN4DA
Extraction code: snje

If this cannot be used, please use other Baidu Solutions

1. Open the command line and execute the GIT init command to create the. Git folder.

2. Create a folder

You can create it manually or by using Vim. We recommend that you learn how to use vim.

3. Run the git status Command to view the status.

Displays helloworld.txt, an untracked file.

4. Use the GIT add command to trace

The cause for the warning is that the helloworld.txt file is the line break of the editor created by VIM in Linux/Unix.

Skip this step.

5. Use git status to continue viewing the status

We can execute the commit operation.

6. Execute git commit-M and enter the submission description"

Because no user name email is set, I am prompted to enter the user name and email

Enter your registered email address and user name on the GitHub website.

Git config -- global user. Email ""

Git config -- global user. Name ""

 

Execute git commit-M "again and submit successfully.

7. View git logs

Submitted

8. Modify the file

Run the git status Command to check whether the file has been modified.

9. Git diff to check the changes.

It indicates that a row is deleted and a row is added. It can be seen that the unit is behavior.

10. Use the GIT checkout --. Command to undo the modification.

Restored successfully

11. Modify the file.

Add git add-A to the temporary storage Zone

Git commit-M "" submitted to Repository

Git Status view status

Check the GIT log (two commits are available now)

12. Return to the previous version (a feature that may be useful in practice)

In the above git log, we can see a string of hexadecimal numbers after the two commit, which can be understood as the version ID.

Use git reset -- hard 2d77dd0

The prompt "head" is now in 2d77dd0

Execute git log and find that only the first commit is left. The previous version is returned successfully.

13. Return to the new version.

Run the GIT reflog command to view the head and find the new version ID.

Run git reset -- hard c0e57ec

In this way, the new version is returned.

14. Delete untracked files

The newly created file mustdelete.txt is in the Tracking State without executing the GIT add-a command. Now delete it.

Use git clean-XF

Git clean-XF: delete all untracked files in the current directory

15. Chinese garbled characters

Run the GIT config -- global core. quotepath false command.

Git log garbled execute the following command to modify the desired Encoding

Git config -- Global i18n. commitencoding UTF-8
Git config -- Global i18n. logoutputencoding UTF-8

15. Connect to GitHub

16. generate an SSH key

Ssh-keygen-t rsa-c "email address"

Copy the SSH key to/C/user/Administrator/. Ssh/id_rsa.pub.

Or run the clip command. <~ /. Ssh/id_rsa.pub

Then paste the SSH key on the GitHub website, as shown in figure

17. Run ssh-T [email protected] on the command line.

Connection successful

18. associate a remote warehouse with a local warehouse

Obtain the remote repository address.

Execute git remote add origin remote repository address

19. Pull the remote warehouse

Git pull origin master

20. Upload and associate the local repository to GitHub.

Execute the GIT push-u origin master command for the first execution (an error will be reported if git push is directly executed)

The first git push-u origin master needs to be associated and can be directly executed later

21. View on GitHub

Uploaded

 

 

Git workflow and initial operation

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.