GitHub Project check-out and commit under Mac

Source: Internet
Author: User

Project Check out

If your git doesn't have a code repository, you can use Git's Code warehouse page to create a new repository.

After creating the repository on Git, we also need to set up a local repository, so open the Mac terminal, set up the local warehouse folder (here I use Helloc), and then go to the new folder

mkdir Helloc

CD Helloc

In the Git page, copy your warehouse address

Then copy the file locally in the terminal via the clone directive (I'm using my git repository address here), then I can see that the project is downloaded locally and I see a readme.md file in the Helloc directory.

git clone https://github.com/ares945/HelloC.git

Project Submission

Now we can copy our code files or projects to the local repository, and then commit; I created a helloworld.c file locally, I can view the status of the local repository via git status, and I find that you are prompted to add the Helloworld.c file locally.

Git status--View local repository

git add helloworld.c--Add files

git status

Git commmit-Commit a file and open the Submit Information window

Git push--update to Git repository

Note that you need git status once before Git commit, to see if the file status is added, and git commit will pop up the record information of this commit, you can edit it and save it so that others can see your updated comment information in git.

After the last input of your account and password (this operation is only required at the first time, after the push file will not need to enter the account and password), the system automatically updates your files to the Git repository

Now, you can go to git to refresh the page to see if the submission is successful, in fact, in the terminal system can also see whether the update is successful We saw a HELLOWORLD.C file that was submitted locally to git, and now we have finished checking out the project from Git and submitting it, and this article also applies to the Linux checkout project and submit

Other

If two people modify the same file at the same time, it will cause a file conflict, the need to commit after the person through the git pull to update the file after merging and then submit, the first person can also be submitted by Git pull the final file pulled down, synchronization files

If there is a problem with the submitted project and cannot be recovered, we can return the item to the previous version, first through the git log view commit to the record, and then copy the code that is normally committed to the following commit, and then roll back to the previous version with the next reset instruction

git reset--hand C417115DCEE90A3ED69D3AA6CE8FA83CF2A0F4CB

If you find that there is no problem with the previous code, you can also view the previous commit version by using git Reflog , and then copy the corresponding action code, returning the previous version via Git reset--hard

These are some of the basic things about GitHub, and if you don't feel like it, you can go straight to the official website to see all of Git's tutorials.

GitHub Project check-out and commit under Mac

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.