Creating Git and its initialization

Source: Internet
Author: User

Creating a repository is very simple, first of all, choosing a suitable place to create an empty directory:

$ mkdir learngit$ cd learngit$ pwd/Users/michael/learngit

Initialize a git repository, using git init commands.

Use the git init command to turn this directory into a repository that git can manage.

$ git initInitialized empty Git repository in /Users/michael/learngit/.git/

If you don't see the .git directory, it's because the directory is hidden by default and ls -ah can be seen with commands.

Add Files multiple times:

$ git add file1.txt$ git add file2.txt file3.txt$ git commit -m "add 3 files."


Initialize a git repository, using git init commands.

Add files to the Git repository in two steps:

    • The first step, use the command git add <file> , note, can be used repeatedly, add multiple files;

    • The second step, using git commit the command, is done.

    • 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.

Creating Git and its initialization

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: 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.