Getting Started with GitHub (1)

Source: Internet
Author: User

If you create a new project now, would you like to submit it to GitHub?

Let's say you've created a project and switched to the project's root directory:

$ git status//view the status of all the articles under the current project, if first you will find all the red color as it has not been handed over to Git/github management.

$ git Add. The (.) dot represents everything under the current directory and is given to git management, which is the local repository that was committed to git.

Ps: The power of git is that there is a concept of a local repository that can submit the updated content to the local repository without a network.

$ git commit–m "discription" //A description of what you have updated or modified.

$ git Remote add origin [email protected]:xiahouzuoxin/zx-libsvm.git

If you are submitting your project for the first time, this is a very important sentence, which is the current project in your local connection to the remote repository.

Ps: origin can be changed to someone else's name, but the next time you push (submit), you will have to use your modified name.

$ git remote-v //view which warehouse address your current project is remotely connected to.

$ Git push-u origin master //submits the local project to the remote repository.

If you were back home, would you like to clone the project submitted by the company locally?

If this is the first time you want to clone a project above GitHub to a local or clone someone else's project to the ground.

$ git clone [email protected]:xiahouzuoxin/zx-libsvm.git

Under git, switch to the file directory where you want to store the project, and run this command to clone the project.

If the project already exists locally and there is a new update in the repository, how do I merge it into a local project?

$ GIT fetch origin //Get remote update, here can be considered as ready to take a

$ git merge origin/master //merge the updated content into the local branch/master

A new warehouse was created remotely, and a new project was created locally, how to make the new project correspond to the warehouse?

In fact, this is very simple, but I was not very understanding of those orders, so more vague, I do not know how to correspond.

$ git Remote add origin [email protected]:xiahouzuoxin/zx-libsvm.git

Or this command, add this sentence before you push the project OK.

[Email Protected]:xiahouzuoxin/zx-libsvm.git is the address of your common new warehouse.] git switches to the new project, before push, with this sentence, the new warehouse we created is connected to the new project.

Some files were deleted in the project, how do I submit them?

If the remote repository has already saved the AAA file, I fetch it down and delete the AAA file, I want to push it up to the remote repository, and make the project in the remote repository overwritten by the new modification (that is, the AAA in the remote Warehouse is also deleted)

$ git status //can see which files we deleted

$ git Add. Delete the files after committing to git administration.

$ git RM src/com/hzh/hibernate/dao/aaa.java //Remove the file we deleted, or git won't allow us to commit to the remote repository.

Ps: If you want to delete a directory (Java package), you want to remove the contents of the entire directory.

$ git RM src/com/hzh/hibernate/bbb/-R /- R will move all the contents of the bbb/directory once.

Getting Started with GitHub (1)

Related Article

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.