Version Control GIt Records

Source: Internet
Author: User

Installing notepad++

1.git is a very powerful distributed version control software that can be used in Windows Linux UNIX

After installing Git, there is no special instructions to operate on Linux Ubuntu all by default.

sudo apt-get install git or download the installation file and unzip it./config Make make Install

Post-install Git--version view version number

2 Create a git library directory,

mkdir git_repository

CD Git_repository

GIT init command to program this directory to git manageable repositories

3 run

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

git config--global user.name "Darren"

Set the user's information and tell git who you are

GIT init sets this directory as a manageable repository for git

4. Create a file Touch test.c add some content

5. Git add test.c//can be used multiple times and then commit once with Git commit

Git commit-m "This was a test file about git manage."

Add and Submit-M is a command parameter for illustrative purposes,

6.git status applies to our current state of the warehouse

git diff is a command that looks at difference to see what changes have been made

    • To keep track of the status of your workspace, use the git status command.

    • If git status you are told that a file has been modified, you git diff can view the modified content.

7. Modify multiple times later if you want to restore (fall back to) a previous version

Using the git log command to show all the changes you've made can also simplify the display with Git log--pretty=oneline.

It's starting to fall back.

First, git must know which version of the current version is, in Git, the current version, that is, the HEAD latest commit 3628164...882e1e0 (note that my commit ID is not the same as yours), the previous version is HEAD^ , the last version is, HEAD^^ Of course up to 100 versions write 100 ^ more easy to count, so write HEAD~100 .

git reset--hard head^

    • HEADThe point is the current version, so git allows us to navigate between versions of history, using commands git reset --hard commit_id .

    • Before you travel, git log you can view the commit history to determine which version to fallback to.

    • To return to the future, use the git reflog view command history to determine which version to return to in the future.

8. Work area--"staging area--" branch

9.

Scenario 1: When you mess up the contents of a file in your workspace and want to discard the workspace changes directly, use the command git checkout -- file .

Scenario 2: When you not only changed the contents of a file in the workspace, but also added to the staging area, want to discard the changes, two steps, the first step with the command git reset HEAD file , back to Scene 1, the second step by scene 1 operation.

Command git rm to delete a file. If a file has been submitted to the repository, then you never have to worry about accidentally deleting it, but be careful that you can only recover files to the latest version and you will lose what you modified after the last commit .

Http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/ 001374385852170d9c7adf13c30429b9660d0eb689dd43a000

$ ssh-keygen -t rsa -C "[email protected]"

Version Control GIt Records

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.