Common commands for Git in Linux

Source: Internet
Author: User
Tags gettext git clone

1. Install dependent packages

sudo yum install curl-devel expat-devel gettext-developenssl-devel zlib-devel

sudo yum install libcurl4-gnutls-dev libexpat1-dev gettext Libz-dev Libssl-dev

2. Install git

Yum-y Install git

3. Create a project directory

mkdir Gitbase

CD Gitbase

4. Create a shared library

sudo git init

5. Clone repository: # git clone http://192.168.8.8/git/first.git6, create file and submit to local repository: # CD first# echo ' OK ' > readme.txt# git add Readme. txt# git commit-m ' first commit ' $ GIT push origin master attached: common commands

(1) Git branch view local branch

(2) Git branch-a View Remote branch

(3) Git checkout branchname Switch branch

(4) Git add yourfile

(5) Git commit-a-M "description" commits your current development to staging area, which can be understood as your local git library

(6) Git pull update, if several people at the same time in the development of a branch, may cause a different step, causing their own local git library behind or early remote Git library, this time to update their local library.

(7) Git push commits to commit the code you have developed to the corresponding remote

(8) Git Status View workspace status and see what's done on this branch

(9) Git log to view the operation log, it is very useful

Git merge Merge branch, the module that you developed will eventually be merged into the total branch of the project, which is to switch to the project master, then git merge its own branch

(one) git branch-d/d yourbranch Delete local branch

git push origin:yourbranch Delete remote Branch

git utility Commands Daquan reference http://www.linuxidc.com/Linux/2013-11/93338.htm

Common commands for Git in Linux

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.