Git combined with Android Studio usage Summary

Source: Internet
Author: User

Use GIT before Please read (there are git basics to skip over) git Guidelines : http://www.bootcss.com/p/git-guide/  

First, download git

http://git-scm.com/download/

Second, installation

All default configurations .

Third, the configuration

    

Run Git Bash

(a) Configure user information:

Enter the following command:

git config--global core.ignorecase false

git config--global user.name "YourName"

git config--global user.email " [email protected]"

(ii) Generate key

Ssh-keygen-t rsa-c "[email protected]"-F ~/.ssh/YourName

In this case, the YourName and yourname.pub two files are generated under the ~/.ssh directory.

In order to open a git user, please send yourname.pub to git administrator.

The above procedures for configuring user information and generating keys are for ease of administration, and you can skip this step if you normally use them.

Iv. first upload the initial code to a new remote repository using the VCs tool in Android Studio.

1. Click "VCS" in the As menu bar and select "Create Git Repository" to create a local repository associated with the project.

Figure 1

2, click "VCS" in the As menu bar, select "GIT", and then select "Remotes ...", click the plus sign in the pop-up window to create a new link to the remote library, in the pop-up window of Figure 3, the name of the 1 is remembered, the following will be used; 2 is the link address of your remote library.

Figure 2

                

Figure 3

3. Select the item you want to upload right click, select "Git", select "Add", and select "Commit Directory ...".

4. Enter the command in the terminal window of as: Git branch--set-upstream master origin/master. "Origin" in this command is the name mentioned in step 2; "Master" is the branch name of the remote library.

5, this step is because there is a "readme.md" file in the remote library, and your local library is not, so use this step to merge the code. In the terminal window of AS, enter the command: Git pull--rebase Origin master. "Origin" in this command is the name mentioned in step 2; "Master" is the branch name of the remote library.

6. Click on the icon of the Sync code (up arrow) in the toolbar to select "Commit and push".

The code is now synchronized to the remote library.

Five, git operation:

1. Delete the file or folder step description on the remote library.

1) First update the code to the same as the remote library.

2) git RM file name NOTE: Replace "file name" with the file name you want to delete. This command is to delete a file

Git RM R folder name Note: Replace the folder name with the name of the folder you want to delete. This command is to delete a folder

git rm--cached "file path" Note: The physical file is not deleted, only the file is removed from the cache. Application scenario: A file accidentally commits to the server.

git rm--f "file path" NOTE: Not only will the file be removed from the cache, but the physical file will be deleted (not recycled into the trash).

3) git commit-m "Delete instructions for your own notes"

4) Git push Origin master

After performing these four steps, you can keep the local files or folders intact, just delete the local library and remote library files or folders.

Acknowledgement:

1, https://www.cnblogs.com/lao-liang/p/5019549.html

2, http://blog.csdn.net/u010316858/article/details/50053387

 

     

Git combined with Android Studio usage Summary

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.