Git series tutorial three configuration and basic commands

Source: Internet
Author: User
Tags git commands

There are many installation tutorials for installing Git online, so you can refer to them. Here is the version of Git with Windows, click here to download. After the basic setup is complete, you can see the new git commands added by right-clicking the mouse button: Git GUI here and git Bash here. Here we use the command-line tool to do some basic git setup. 1, user settings Right click on the mouse to choose Git Bash here, pop-up command window, typing the following command: Git config user.name yourName
git config user.email youremail This is the user name and email address set by the operator in the current user environment. (The profile address is the current user directory, such as C:\Users\Administrator\.gitconfig) if you want to set all users of the current machine, use--syetem instead of--global. (config file in Git's installation directory, for example: C:\Program files\git\mingw64\etc\gitconfig) If you want to set a project separately, remove the--global (under the current project's. Git directoryNote: You must be in a git repository)。 2. The editor settings git uses vim as the editor by default, which may be used when you open a file with a command or enter a long commit message. Here's how to set the editor to the Notepad that comes with your system and how you set up your own sublime two editors. Ⅰ, Notepad system comes with the editor is easy to set up, execute the following commands: Git config core.editor Notepadⅱ, sublime set their own installed editor, you need to put the editor's installation path in the operating system environment variables to open the Control Panel-- > Systems--Advanced system settings--Advanced environment variables--System variables Path variable name add: C:\Program files\sublime Text 2; then execute the following command: Git config core.editor The reason for "sublime_text-w" to add-W is to let Bash wait for sublime to close. Third, the creation of the repository version of the repository is the equivalent of a directory, everything in this directory can be managed by git, choose a suitable place, create an empty directory. Enter the empty directory and run the command: GIT init executes this command, prompting you to create an empty git repository under which path, and creates a hidden. Git folder in the current directory. Don't change things in this folder, or you can easily mess up the Git library.3.1 Initializing the repositoryIv. Add the file 1, execute the command at the command line: Git status Displays the result:3.2 First View repository statusThis command tells us the status of the files in the current library, and figure 3.2 tells us that there are no files to submit. 2. Add a file and execute the command again: Git status Displays the result:3.3 View repository status againFigure 3.3 tells us that the current directory has added a text file 1.txt, but has not been added to the Git repository, follow the prompts us to execute the command: git add 1.txt after executing the add command, there is no hint, according to UNIX, no message is good news. 3. Execute the command again: the current display of Git status tells us that 1.txt is ready to submit. 4, follow the prompts, execute the command: Git commit-m ' Add new file 1.txt ' So far, we're going to put a file in the Git repository. Five, command review this section we mainly use five commands git init, git status, git add, git commit. 1. Initialize the GIT repository:git init2. Configure the Git repository:git config [<option>] <key> <value>3. View git repository Status:git status4. Add files to the Git repository:git add <filename>5. Initialize the GIT repository:git commit-m <message>

Git series tutorial three configuration and basic commands

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.