Common Git Commands

Source: Internet
Author: User

$git Init

$git Add Ss.txt

$git commit-m "Note"

$git status

$git diff Xx.txt

$git Log--pretty=oneline

$git Reset--hard head^

$git Reflog

$git Chekout--xx.txt//Undo All Xx.txt modifications to the workspace

$git Reset HEAD name.txt//Undo the Name.txt file in the stage

$git RM name.txt//delete files and submit

$git remote Add origin [email protected]:xx/xx.git

$git push (-U) Origin master//push local branch to remote library

$git Clone [Email protected]:xx/xx.git

$git checkout-b dev//create Dev Branch and switch to Dev

$git Branch

$git Checkout master//Toggle Master

$git Merge Dev

$git branch-d dev//Remove Dev Branch

$git log--graph--pretty=oneline--abbrev-commit//View Branch merge diagram

$git Merge--no-ff-m "merge with No-ff" dev//Disable Fast-forward branch merge

$git Stash//Store the current work site

$git Stash List//view the saved work site

$git Stash Appy//recovery work site

$git statch Drop//Delete work site

$git branch-d dev//forcibly remove dev

$git Remote

$git rebase

Dev1

C1 <-C2 <-c3 <-C4-< c5 git rebase dev1

<-c6 <-C7-< C8-------------------> C1 <-C2 <-c3 <-C4 <-c5 <-c6 < ;-C7 <-C8

Dev2

$git rebase--continue//Continue Rebase

$git rebase--abort//Stop rebase, return to the state before rebase

$git Cherry-pick

DEV1 git checkout Dev1

C1 <-C2 <-c3 <-C4-< c5 git chery-pick c6 Dev1

<-c6 <-C7-< C8-------------------> C1 <-C2 <-c3 <-C4 <-c5 <-c6

Dev2

Common Git 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.