Chapter II-The second question (practice using Git's add/commit/push/pull/fetch/clone and other basic commands)--Wang Zhe

Source: Internet
Author: User
Tags using git github ssh key

Each person builds a HelloWorld project and exercises basic commands such as Git's add/commit/push/pull/fetch/clone. Compare the differences between the old and new versions of the project.

steps to use:

A) New HelloWorld project

b) Create a local repository and set up git mailboxes, user names, and more

Create a Helloworld.java file locally

Open git Bash and turn git init this directory into a repository that git can manage with commands

Set up Git's user name and mailbox, among other things

c) Set up the GitHub SSH key

d) Actions related to add, commit, pull, push, fetch, clone commands

e) Problems encountered during command operation and Solutions

When you use Git to execute a push command to the source code to GitHub, you encounter error:failed to push some refs to ' [email protected]:summerzhe/hello-w Orld.git '

The main reason for the error is that the readme.md file in GitHub is not in the local code directory;

You can use commands to merge code, that is, git pull--rebase Origin master;

After executing the above code, you can see that the local code base has more readme.md files

Now execute the statement GIT push-u Origin master to complete the code upload to GitHub

Code can be checked in GitHub

Experience:

About commit:

Translation organized from: http://web.mit.edu/~mkgray/project/silk/root/afs/sipb/project/git/git-doc/git-commit.html

        When using Git for versioning, I need to execute the git commit command to add the indexed content to the repository.         GIT commit  -m  "submitted description"         If we don't use the-m parameter here, Git will move to a text compiler (usually vim) to let you enter a description of the submission         Maybe one day you have updated many of the documents in the work tree (document additions, modifications, deletions), but I forgot their names. If you add all of your updates to the index, compare Burthen:        GIT commit -a -m  "submitted description"       The-a  option of the   git commit  command only commits all modified or deleted documents that have been managed by git to the warehouse. If you just modify or delete a document that has been managed by git, it is not necessary to use the git add  command.         git add . command in addition to the ability to determine the current directory (including its subdirectories) all modified or deleted documents, but also to determine the user added new documents, and append their information to the index.         git commit --amend  for comments that have been modified, you can do so with git commit--amend if you need to modify it.         For example the latest submission in framework/base is resolving the roaming problem, which I now need to change to resolving the roaming prob Lem for fixing bug 7732        Enter git commit--amend under Framework/base, it will enter a text editing interface (below), modify it in the comment, save And then quit, so that the comments are modified, and then re-PUSH.&NBsp       In addition, it is important to note that GIT does not actively record your updates to the document unless you dictate it (e.g. via the Git add command)

Chapter II-The second question (practice using Git's add/commit/push/pull/fetch/clone and other basic commands)--Wang Zhe

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.