Git User Guide

Source: Internet
Author: User
Tags git client

    • Installation
    • Configuration
      • Set User name and email
      • ADD SSH Keys
    • Repository
      • Create New Repository
      • Clone Existing Repository
    • Git operation
      • Pull
      • Push
      • Merge
Installation

Msysgit is a Windows version of Git client. Download This installation package and install it:https://github.com/msysgit/msysgit/releases/download/ Git-1.9.5-preview20141217/git-1.9.5-preview20141217.exe

Use the default configuration is OK. Just Click "Next" button all the the-the-end.

Configuration Set user name and email

Open Git Bash from the desktop (or any folder) by right click:

Config your user name and email: (They should is the same with your Git profile settings)

" Shishang, Yilin "  "[email protected]"

The Add ssh keysopen Git Gui from the start menu:04 Click Show ssh key:screenshot001 There is no SSH Key currently. Click Generate key:screenshot002 Git would promt to request your set a passphrase for your SSH Key, but it's not necessary . Just Click OK to leave it empty:screenshot003 ScreenShot004 Select the whole SSH key text and click Copy to CLIPBOARD:SC reenShot008 Go to Gitlab profiles settings > SSH keys > Add SSH key:screenshot006 Paste your Key here:screenshot007 Click the "title" input box, the title'll be generated automatically:screenshot009 Click Add Key and it's Done:scree nShot010 last Step:test your SSH link to the GIT server to verify your key have been added correctly, open git Bash and in Put:ssh[email protected]Input Yes and It's OK when you see Welcome to Gitlab, ... ScreenShot011 repositorycreate New Repositoryto Be Continued ... Clone Existing Repositoryyou can clone the Existing project repository to your local machine, so can work on it. First you need to get the source location like below project ' first ': Shishang Yilin first GitLab Create a new folder on Y Our computer and open Git Bash:screenshot 001 clone the source Repository:git clone[email protected]: Shishangyilin/first.git screenshot 002 You can see the downloading information and wait until the clone is Done:screensh OT 003 After the clone was done, open Git GUI and select Open Existing repository:screenshot 004 Browse to the Repository folder that git clone created (It's in the folder which your created): Screenshot 005 Click Open and this is your project W Orkspace, you can commit/checkout/merge changes here:screenshot 006 Git operationpullgit Pull command was used to update y Our local repository with the latest version of source repository, it would also merge your local changes with the fetched Source repository changes automatically. First, create a quick access tool in git gui:screenshot 018 the command was git pull:screenshot 019 then can simply C Lick the git pull tool to update the Repository:screenshot 020 you can see the details like how many changes updated in T He message Window:screenshot 021 pushgit Push is used to commit your changes to source repository. BeforE You start your change, it's better if you are pulling the changes from source repository first. After your finish your code change, open Git GUI and press F5 to refresh the unstaged changes:screenshot 007 you can see T He files list of your change on the left, and click on the one file can see the code diff on the right. Here's can examine your change and when it's ready, select the file is need to commit and click on Stage to commit or Pres s Ctrl + t:screenshot 008 Then the file'll be moved from the red zone unstaged changes to the Green Zone staged changes (would Commit). Note:only the staged changes'll be commited. In the commit Message, input your comments on this commit. can refer to the issue related to this commits with a #1 (the issue number) and the issue would be connected and closed By the commit. Click Commit when your is Done:screenshot 009 after Commit, you need to push the changes to the source repository, click Push and confirm It:screenshot 010 you can see the pushDetails if it succeeded:screenshot 011 in the above example, we refered the #1 issue so the issue have been connected to T His commit and closed:screenshot 016 Mergewhen Your change conflicts with the source repository, Git pull or push would FA Il:screenshot If you failed in pull and your changes have not been commited, commit them:screenshot 013 If you have commit Ed your changes and failed on push, click Remote > Fetch from > Origin:screenshot 029 then click Merge > Local M Erge or press Ctrl + m:screenshot 014 Select The branch you want to merge into and click Merge:screenshot 015 If There I s no conflicts, the merge would complete automatically. Then you can skip the following steps on Conflict-resolving, just commits the merge changes and push to source repository a Ccording to the instructions after conflict-resolving. If There is conflicts, the merge would fail:screenshot 022 in Git GUI can see the conflict file details. HEAD means your current branch status, Origin/maSter is the source repository branch which you are merging Into:screenshot 023 Edit The conflict file, remove the Auto-ge nerated notes and merge the changes by Editing:screenshot 024 commits the merge Changes:screenshot 025 Push to source Rep Ository:screenshot 026 success! Screenshot 027 in the Project Network view, you can see the merge on the parallel commits:screenshot 028

Git User Guide

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.