Check out and submit GitHub projects under Mac
Project check-out
If your git has no code repository, you can use the git code repository page to create a new repository.
After creating a repository on git, we also need to create a local repository, so open the Mac terminal, create a local repository folder (here I use HelloC), and then go to the new folder.
mkdir HelloC
cd HelloC
Copy your repository address on the git page
Then, copy the file to the local device through the clone command (here I use my git repository address), and then you can see that the project is downloaded to the local device, the HelloC directory contains README. md File
git clone https://github.com/ares945/HelloC.git
Project Submission
Now we can copy our code files or projects to the local repository and submit them. I created a helloworld. c file, you can view the status of the local repository through git status, and find that the system prompts you to add helloworld locally. c file
Git status -- view the local repository
Git add helloworld. c -- add a file
Git status
Git commmit -- submit a file, and the submit information window is opened.
Git push -- Update to git Repository
Note that you need to run git status once before git commit to check whether the File status is added. After git commit, the record information for this submission will pop up. You can edit and save it in it, so that others can see your updated remarks in git.
After you finally enter your account and password (this operation is only required for the first time, and you do not need to enter the account and password after pushing the file ), the system automatically updates your file to the git repository.
Now, you can go to git to refresh the page to see if the commit is successful. In fact, you can also see whether the update is successful in the terminal system. In, we can see the helloworld that is submitted locally to git. c file. Now we have finished checking out the project from git and submitted it after modification. This article also applies to linux terminal checking out the project and submitting
Others
If two people modify the same file at the same time, a file conflict will occur. At this time, the person who needs to submit the file will update the file through git pull and merge it before submitting it, you can also use git pull to pull the final submitted file and synchronize the file.
If a problem occurs in the submitted project and the project cannot be recovered, we can return the project to the previous submitted version and view the submitted record through git log, copy the code that is normally submitted to the end of commit, and then roll back to the previous version using the reset command.
git reset --hand c417115dcee90a3ed69d3aa6ce8fa83cf2a0f4cb
If you find that the previous code is correct, you can use git reflog to view the submitted version before rollback, copy the corresponding operation code, and return the previous version through git reset -- hard.
GitHub Tutorials:
Create a personal technical blog via GitHub
GitHub tutorials
Synchronize code from Linux to the GitHub code repository
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
GitHub details: click here
GitHub: click here
This article permanently updates the link address: