Objective
In order to facilitate the preservation of their own code, after work can go home to continue to work, their yards of farming, introductionGithub.
What is GitHub?
As a programmer, I think I need to know aboutGithubit!
Of course, if you give up the identity of the yard or technical personnel, do not have to understand, say not much,Githubis a code-basedGithosting platform, you can save your own code on the site, when you need, you can pull your code on the platform to your computer, continue to work, this is not very convenient?
of course, if you say in addition to put the code, can you put other files? the answer is yes. In additionGitHub, there are actually related sites can be stored, but here do not introduce.
Have your own GitHub account
First have your ownGithubaccount, then go to register agithubwebsite: https://github.com/. Do you want to register without tutorials? Then comes the interface like:
Of course you will see all is English, but also do not fear, I use the browser is Google, download a translation plugin is good, see the Chinese subtitles easy to understand the site, do not understand, and then I will talk about:
Now let's install Git
So what are you going to ask?Git(There are so many problems!) *_*)
Gitcan be considered to submit documents to theGithubabove, is a free, open source distributed version control system, isGita learning, learnGitto learn aboutLinuxthe command line, of course, you do not have to worry, first learnGitto use the submission code toGithubit!
Said so nonsense, we first downloadGit, installGit.
GitThe download website is: https://git-scm.com/downloads.
GitThere are many versions of the download we look at:
Of course, in addition to the site, I also provide aWindowsversion of their own, link address: http://download.csdn.net/download/qq_36232611/10182464
This is very convenient, after the installation of their ownAndroid StudioGit, do not need to set up the environment can be in theAndroid Studioproject submitted toGithub.
Show powerful software after download:
NextGitWe must understand, theGitbasic concept, on the three content: (Oneself on-line understanding I also do not understand well!) )
- Workspace: The files that you have on your computer that you want to submit.
- Staging Area: Isindexit a file?
- Repository: Is.gitthe hidden file.
Maybe you don't quite understand the content, let's start with:
Open yourGit, enter the command line:
$ git config--global user.name "your name"
$ git config--global user.email "[Email protected]"
These two lines are set upusernameand areemailremembered for your account, and then each time you submit it to your account. Of course, enter these two lines, enter a row to press theenterkeyok. Thatyournameis the name of your account,your_....comwhich is your email account.
Teach you how to submit projects or code to github hosting
Start theGit Bashcommand line
First open yourgithub, click New Project, clicknew repositories, and then directly to the project name just fine
Open the command line and enter below
Copy address is: Https://github.com/..../Test.git
Click here to copy the link:
Enter command line
$ git clone https://github.com/...
$ CD Test
Under the premise you have to copy your project into thetestpath.
$ git Add.
$ git commit-m "Changes log"
$ GIT push origin master
Appear with the picture as proof of success, and then on your own togithubsee if the file you submitted is successful.
Another kind of description, isGit:to rely on (of course, you still have to enter the above two lines of code)
gitCommand: (English translation, not too good, forgive me)
These are common Git commands used in various situations:
Here are various descriptions used by the Git command line:
start a working area (see also: git help tutorial):
clone Clone a repository into a new directory
Cloning a resource to a new local directory is like copying and pasting
init Create an empty Git repository or reinitialize an existing one
Create an empty Git repository or re-initialize an existing repository.
work on the current change (see also: git help everyday)
add Add file contents to the index
Adding 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
Reset the current head to the specified state
rm Remove files from the working tree and from the index
Delete files from working tree and index
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
Use binary search to find commits that introduce bugs
grep Print lines matching a pattern
Print lines and patterns match
log Show commit logs
Show commit log
show Show various types of objects
Displaying various types of objects
status Show the working tree status
Show working 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 branches or restore working tree files
commit Record changes to the repository
Record changes to the repository
diff Show changes between commits, commit and working tree, etc
Show changes between commits, commits, and work tree
merge Join two or more development histories together
Join two or more development history together
rebase Forward-port local commits to the updated upstream head
Forward port is submitted locally to the updated upstream header
tag Create, list, delete or verify a tag object signed with GPG
Create, list, delete, or verify tagged objects signed with GPG
collaborate (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
Get and integrate from another repository or local branch
push Update remote refs along with associated objects
Update remote refs with related objects
We open theGitsoftware, enter a command, create a new file
mkdir test (create test folder)
cd test (switch to the test directory)
touch text.php (create text.php file)
Then enter thegit statuscommand, this command can be more input, see the effect, the next input submitted, inputgit add .("." This is the English point Oh, note, means to add all the files, you can also submit the files you need, then the "." to your file name is good), then entergit commit -m" Description ":
Git commit-m "First commit"
Then press theEnterkey and then submit togithubthe command:
Git push Origin Master
This will be done, so you can see it on your account. When submitting, when you enter thegit pushcommand line, attention will let you enter the password proof, you enter your account number and password is OK, of course, you will find in the input, how did not enter it? That's because it's hidden, you just type it.
How do I create my own project on GitHub?
Here's a look at the English concepts that are encountered in GitHub: (Explain what the buttons are about?) )
Casually introduce: (some useless, do not introduce, senior programmer on their own to understand OH)
Code: Show your project or file you submitted
Issues: When your project has bugs, other account users can send tips or raise issues to notify you.
Pull Requests: someone else cloned your project to his own account, then the other party changed the code, and then he sent Pull requests to change himself, and also made corresponding changes on your project
Settings: the meaning of settings, the content is quite rich, haha, it is easy to understand
commits: the number of commits, you can view the effect
contributor: indicates whose project can be collaborated by multiple people, and the author will be displayed
Repositories: Represent your own items, click to display items
Star: the effect of adding a favorite, like the project
Fork: This is a cloned project. When you see someone else ’s project, you can click the button to copy it to your account.
Watch: It means someone is watching your project, watching the file
Edit: Click to edit, write a description of the project, and describe the content, so that your project can be known to more people
Description here is not a lot of knowledge, I think than watching the video faster ^ _ ^, understand the understanding, you have to operate on their own, practice a few times, good, practice is the only standard to test the truth Oh!
Here is the Androidstudio upload GitHub tutorial Oh!
Click on the table of contents on the well-written projectapp,右键->Git->Commit Directory
Check to see if all required files are in the window and are checked, thenCommit Messagewrite down the notes in, and then clickCommit and Push
Click here toCommit
ClickPush
Wait for theSuccessfulprompt to upload successfully
Conclusion
- This article mainly explains? git Getting Started Basics tutorial-androidstudio uploading GitHub Tutorials
- I will continue to explain the other knowledge in depth, I am interested to continue to focus on
- A little gift to walk or like.
An article about GitHub and git tutorials-androidstudio uploading github tutorials