The theme of this practice is to host projects on GitHub through GIT in a Windows environment. By practicing, basically mastering the use of some GIT commands, registering an account on GitHub and learning to create repositly and organization, try to implement the upload (push), download (clone) function. Here is my summary of the process of this practice.
First, prepare
Download git for Windows and register your account on GitHub.
Second, use the GIT for Windows command line to implement basic functions
Let's introduce some of the more common command-line commands:
PWD: View the path to the current directory.
CD/CD. /CD "directory name": Go back to the root directory (/c/user/administrator)/go back to the top level directory/Enter subdirectories.
mkdir "file name": Create file.
Cat: View the contents of the file.
1), configure the information registered on GitHub.
git config--global user.name "user name"
git config--global user.email "mailbox for registering a GitHub account"
2), create a project into a workspace
First go to the project:
Then execute git init and a git file (hidden file) will appear
The workspace is initially built, and you can start using some git features here.
3), use git add and git commit to add the file to the local master.
4) Upload the ready-to-use project to GitHub's designated repository
First, create a organization on GitHub and create an empty repository with the same name as the repository we are uploading locally.
Then use git push to upload the repository.
Git remote add Origin https://github.com/sefzu2015GHello/MyApplication.git
Git push-u Origin Master
Finally, refresh GitHub and it's OK.
5), copy repository from GitHub to local
Enter the directory you want to specify first: Cd/g/clone
Then just execute the git clone.
Iii. Summary
In fact, just learn to use git push and git clone will basically be able to master the most important functions. But practice is really a lot of problems, as a rookie, I started to find a tutorial, and then follow his steps, step by step follow him, try to understand the above comments, and finally can come to a more decent results, but often are aware of it, do not know why, if according to his idea is of course very smooth, but , when you want to achieve some of the functions expected to see, you will find the problem one by one, and then often for a puzzling problem to engage in headaches, entanglements. So feel to use the cool words or to spend a lot of energy, or to compare the system to learn more comprehensive, more in-depth study, see one or two tutorials at most can only solve the urgent need, ultimately not a long-term solution.
Four, summary (record some of the more commonly used GIT commands, convenient for later query)
Git init create workspace
git add "file"
git commit-m "comment" submitted to master Branch
Git Status View current status
git log View history
git reset--hard head~ "version number" restores a historical version
Git checkout--"file" revocation
Git remote add Origin URL
Git push-u Origin Master (as soon as GIT push Origin master is available)
git clone URL
git config--global user.name "user name"
git config--global user.email "mailbox for registering a GitHub account"
Hello World code Base: Https://github.com/sefzu2015GHello/MyApplication.git
Recommend a more detailed tutorial: http://blog.jobbole.com/78960/
Soft work Practice L exercise one by one using GitHub managed projects