Github and Git tutorials and GithubGit tutorials
Github
What is Github?
As a programmer, I think I have to know about Github! Of course, if you give up the identity of a programmer or technician, you don't have to understand it. To put it bluntly, Github is a Git-based code hosting platform, you can save your code on the website. If you need it, you can pull your code to your computer on the platform to continue working. Is this convenient?
Of course, can you put other files besides code? The answer is yes. In addition to GitHub, there are actually related websites that can be stored, but we will not introduce them here.
Have your own Github account
First have their own Github account, then go to register a github Official Website: https://github.com /. Don't you need a tutorial for registration? Then, enter the interface as shown in the following figure:
Of course, you will see that all of them are in English, but you don't have to worry about it. I use Google in my browser. Just download a translation plug-in. It's easy to understand the website when I see Chinese subtitles, next I will talk about it:
Now let's install Git. What is Git? (There are so many problems! *_*)
Git can be considered as a free and open-source distributed version control system that submits files to Github. Git is also a learning tool, to learn about Git, you need to learn about Linux-related command lines. Of course, you don't have to worry about it. You should first use Git to submit code to Github!
To put it bluntly, we should first download Git and install Git. There are many versions to download from Git. Let's take a look:
Of course, in addition to the website, I also provide a Windows version for my own
This is very convenient. After installation, you will have Git in your Android Studio. You can submit the project to Github in Android Studio without setting the environment.
Show the powerful software after downloading:
Next, Git must understand the basic concepts of Git. There are three items: (I don't know much about Git on the Internet !)
Workspace: the files on your computer.
Temporary Storage Area: is the index file?
Version Library: a hidden file of. git.
You may not understand the content yet. Let's start:
Open your Git and enter the command line:
$ Git config -- global user. name "your name"
$ Git config -- global user. email "your_email@qq.com"
These two rows are set to username and email, that is, remember your account, and then each submission will go to your account. Of course, if you enter these two rows, enter a line and press enter. Yourname is the name of your account, and your _ ...com is your email account.
How to submit a project or code to Github
Start Git Bash command line
First open your github, click new Project, click new repositories, and name the project directly.
Open the command line and enter the following:
Click here to copy the link:
Enter the command line
$ Git clonehttps: // github.com /...
$ Cd test
You must copy your project to the test path.
$ Git add.
$ Git commit-m "changes log"
$ Git push origin master
The file is successfully displayed in the same way as the image, and then you can check whether the file submitted by yourself is successful on your github.
Another description is to rely on Git: (of course, you must enter the above two lines of code)
Git command: (translated in English, not very good, sorry)
These are common Git commands used in various situations:
Here are various descriptions used by the Git command line:
Start a working area start a work area (see also: git help tutorial ):
CloneClone a repository into a new directory
Clone a resource to a new local directory, just like copying and pasting.
InitCreate an empty Git repository or reinitialize an existing one
Create an empty Git repository or reinitialize an existing repository.
Work on the current change process current changes (see also: git help everyday)
Add Add file contents to the index
Add file content to the index
Mv Move or rename a file, a directory, or a symlink
Move or rename a file, directory, or symbolic link
Reset Reset current HEAD to the specified state
Resets the current header to the specified status.
Rm Remove files from the working tree and from the index
Delete files from the work tree and Index
Examine the history and state check history and status (see also: git help revisions)
Bisect Use binary search to find the commit that introduced a bug
Use binary search to locate the submission of introduced bugs
Grep Print lines matching a pattern
Print line matching pattern
Log Show commit logs
Show submitted logs
Show Show various types of objects
Display various types of objects
Status Show the working tree status
Display Work tree status
Grow, mark and tweak your common history
Grow, Mark and adjust your common history
Branch List, create, or delete branches
List, create, or delete branches
Checkout Switch branches or restore working tree files
Switch the branch or restore the work tree file
Commit Record changes to the repository
Record changes to the repository
Diff Show changes between commits, commit and working tree, etc
Display changes between submission, submission, and work tree
Merge Join two or more development histories together
Add two or more development history together
Rebase Forward-port local commits to the updated upstream head
The forward port is submitted locally to the upstream header of the update.
Tag Create, list, delete or verify a tag object signed with GPG
Create, List, delete, or verify the tag object with the GPG Signature
Collaborate collaboration (see also: git help workflows)
Fetch Download objects and refs from another repository
Download objects and refs from another Repository
Pull Fetch from and integrate with another repository or a local branch
Obtain and integrate from another repository or local branch
Push Update remote refs along with associated objects
Update remote refs together with related objects
Open the Git software and enter the command to create a new file.
Mkdir test (create the test folder)
Cd test (switch to the test directory)
Touch text. php (create a text. php file)
Then enter the git status command. You can enter the command multiple times to view the effect. Then, enter submit and enter git add. (". "This is an English point. Note that you can add all the files or submit the files you need ". "change to your file name), then enter git commit-m" Description ":
Git commit-m "first commit"
Press Enter and submit the command to github:
Git push origin master
In this way, you can submit the application to your account. When submitting the command, when you enter the git push command line, note that you will be asked to enter the password proof, and you will enter your account and password. Of course, you will find that, why didn't I enter it? That's because it is hidden. You just need to input it.
How can I create my own project on github?
The following describes the concepts of English in GitHub: (What are the buttons ?)
Just give a brief introduction: (some are useless. If you don't want to introduce it, Senior programmers will understand it by themselves)
Code: displays your project or submitted files.
Issues
Pull Requests: Someone Else cloned your project to his account, and then the other party changed the code. Then he sent Pull requests to change it, make corresponding changes in your project.
Settings: It means the setting. The content is quite rich. Haha, it's easy to understand.
Commits: the number of submissions. You can view the results.
Contributor: indicates the project of the creator. If you can cooperate with multiple people, the author is displayed.
Repositories: indicates your own project. Click Show project.
Star: indicates the effect of adding a favorite and thumb up the project.
Fork: This is the clone project. When you see other projects, you can click the button to copy them to your account.
Watch: indicates that someone is watching your project and files.
Edit: Click to Edit, write the project description, and describe the content, so that your project can be known to more people.
I think it's much faster than watching videos. ^ _ ^. You must perform operations and practice several times on your own, practice is the only criterion for testing truth!
The following is a Github upload tutorial for AndroidStudio!
On the prepared project, right-click the app Directory and choose Git> Commit Directory.
Check whether all required files are in the window and checked, write the remarks in Commit Message, and click Commit and Push.
Click Commit here.
Click Push
Wait until Successful prompts that the upload is Successful