1.1. Creating a local project and submit a remote repository library
1. Install the plug-in ecliplse the git;
Ecliplse the plug-in installation Address:
Egit - http://download.eclipse.org/egit/updates
2. Create a local project to be uploaded as an empty library in github;
3. Right-click the project in the local library -> team-> share Project-> Git;
4. Click the "use or create repository in parent folder of project";
5. Then click "create repository", and then click Finish;
6. The local library has been built at the moment, you need to submit a file to be submitted to the local library:
Right-click in the local project -> team-> commit-> select the file you want to submit and add comments -> Click Submit commit such local library has been completed;
7. The library will be submitted to the local push to a remote repository:
1. Right-click the project -> team-> remote-> push
2 Fill in the url github project, and fill user and password
3 Click next
4 Select and add source ref
5 Click next if there are no conflicts file, click finish
6push successful, pushed to ... dialog box will pop up.
1.2. Remote library project to obtain and modify Submit
1. Switch eclipse view to the next git repository;
2. Click clone git repository:
User Settings git project location and choose to use the ssh connection, use https connection here, then there is an exception if you are using ssh connection will not happen this anomaly;
3. Select Branch branch;
4. Select the location into a local directory;
5. The import was successful.
2.Android Studio use
2.1. Create a local repository to github and Share
Mode 1: studio interface
1. Configure git.exe path: Setting-> Version Control-> Git click Test After setting the test, the pop-up version, the configuration is successful;
2. Configure github account: Setting-> Version Control-> GitHub;
3. Select the item you want to share, select the menu bar -> VCS-> Import into VersionControl-> Share project on Github;
4. A pop-up box to set the name and description repository library settings;
5. Select the file you want to commit to github;
6. Choose to commit and push.
Method 2: Command form
1. Open git bash, to push into the project directory;
2. Create an empty library gitHub;
3. Enter the following command in the git bash;
1.git init initializes a local library;
2. * Set some unwanted add and commit files .gitignore in;
3.git add all the files to be added to the committed state.;
4.git commit -m "submit description" to add the files to the local library;
5.git push -u origin master initial submission.
git push origin master, which means that the current upload local branch code to the master branch. git push is to upload all the local branches of the code corresponding to the remote branch
2.2.clone github project on local
1. Open the git bash into the directory where you saved the project to clone;
2. Enter the command: git clone + ssh clone link on github;
3. If you id_rsa file has a password, enter the password after the start of clone.
3.git additional tips
3.1. Push resolve conflict
When people developed in collaboration inevitably lead to conflicts push updates to the server, so it is necessary to resolve the conflict and the latest version of the server-side before pushing local warehouse. Pull operation is to update the server-side to win over local warehouses combined, resolve merge conflicts, it can successfully push to the branch server.
1.A modified the file server 1, and the first push to the server;
2.B also modify a file server 1, and pull to combine local and remote repository, there is a file conflict, git merge itself;
3. Merge files can not be submitted directly, right conflicted file -> team-> merge tool;
4. Select the file with the latest version of the local server and compare;
5. Modify file conflict;
6. After the conflict resolution is completed, right-File Team-> add to index the file again added to the index and can push to the server;
7.A can now pull the file server to the local library, which completed a two collaborative development.
3.2. Reset function
Resetting the current branch to a specified location commit record, index and working tree unchanged;
Resetting the current branch to a specified location commit record, the index is updated, the same working tree;
Resetting the current branch to a specified location commit record, index and working tree is updated.