Common git commands

Source: Internet
Author: User
Tags git commands

1. Git remote–v

View Remote repositories

2. Git remote add weixin-old-remote https://git.sprucetec.com/meicai/weixin-old.git

Add a remote repository

3. Git fetch upstream

The pull does not change in the local repository and does not modify your own files.

4. Git branch–r

View all branches on a server

5. Git branch–a

View all branches on the local and server

6. Git branch Mybranch

Create a branch named Mybranch

7. Git branch-d mybranch

Delete Mybranch Branch

8. Git checkout Mybranch

Make Mybranch A current active branch

9. Git checkout-b mybranch

Creates a Mybranch branch and acts as the current active branch

Ten. Git checkout--protected/views/

Pull the contents of the server-side protected/views/folder

git merge Mybranch

Merge the Commit of the mybranch to the master branch

Git rebase weixin-old-remote/v.150906_shanghu

Get the latest code on the branch V.150906_shanghu, merge it, and put your far end at the top

Git stash

Save current changes

. Git Stash List

View the stash list, which is to view the staging list

The. Git stash pop

Take out the latest staging data

. Git status

View status, list all files in the current directory that have not yet been managed by git, and files that have been managed and modified by git but have not yet been submitted

. Git log

Viewing log information

Git push Origin V.150906_orderread

Push to remote

git diff <source_branch> <target_branch>

. Git diff peotected/views/

Gets the changes to the contents of the peotected/views/file in the current active branch

. Git reset head.

Fallback to previous version

A. Git Add.

Submit File

. Git commit-m ""

Submit a Comment

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.