How to use Gitlab to do code review__git

Source: Internet
Author: User
Tags ssh git clone

First reference:
git tutorial
Git easy tutorials (enough for everyday use) –by Liao Xuefeng
git remote operation –by Nanyi 1. Git basic concept workspace/working directory: Workspaces
Is the directory you can see on the computer index/stage: Registers
Change through git add to here Repository: Version Library
Git commit change to here
(Previous three concepts can refer to the workspace, registers, and version library) remote

Branch 2. Common git command local

Git add/rm-<file/directory>
Git commit-m "xxxx" remote

Git push origin < remote branch >:< local branch > Branch

Git branch Dev:
Create Branch Dev
git branch-d Dev:
Delete Branch Dev
git checkout dev:
Switch to Dev Branch
git checkout-b Dev < branch:
Create a new branch called Dev, and switch to Dev, which is equivalent to

git branch dev
git checkout dev

The following < branch > refers to which branch is base, usually set to Origin/master 3. Code review A dev branch from the Origin/master branch by using a branch :
git checkout-b dev origin/master make some changes to the Dev branch add to local stage
Git add/rm <file/directory> commit to local repository
Git commit-m "<notes>" push to remote branch
Git push origin < remote branch >:< local branch > A merge request from Dev to master to understand git merge and git rebase git crash course in Web pages: git rebase git book Chinese version rebase General Merge branch to remote master Process switch to local master
git checkout master pull the remote library to the local workspace
Git pull Origin master merges the Chi-dev branch to the local master
Git merge Chi-dev at this point if there is a conflict, resolve the conflict (you can see the branching and consolidation base):
Executing git status will show that these files are not merged (unmerged), and these conflicting files will have the following conflicting identifiers added:

<<<<<<< HEAD:file.txt
Hello World
=======
Goodbye
>>>>>> > 77976da35a11db4580b80ae27e8d65caf5208086:file.txt

All you have to do is edit the conflict (delete the conflict identifier, change the code), the equals sign and the 7 < is the head, the equals sign and the 7 > is 77976da35a11db4580b80ae27e8d65caf5208086 Submit the editors you just made to the index
Git add to submit these edits to Repository
git commit to remote version library
git push resolves conflicts

That's a good one:
Resolving a merge conflict from the command line
Conflict there are two kinds of two people who changed the same line of the same file two people changed the file one by one, and the other deleted the file. if I need to start from Origin/master, local changes will not move, how to operate. getting data from the server
Git fetch origin A new branch (such as Serverfix) on the basis of a remote branch.
Git checkout-b serverfix Origin/master continues to develop on Serverfix 4. You will use: undo changes git-contribute to the project GIT branch-remote branch git ssh How to use: First in local Generate SSH key:ssh-keygen-t rsa-b 4096-c "your_email@example.com", and then in the Gitlab profile settings add key git ssh with two different host:1. Ssh-keygen-t rsa-c "xx@email.com" 2. Ssh-add 3. Add public key 4 to the BitBucket. Add configuration 5 to ~/.ssh/config. git clone git@bitbucket.org/xxx try

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.