Build and use Git servers, and build and use Git servers

Source: Internet
Author: User

Build and use Git servers, and build and use Git servers


Git is a distributed version manager with powerful functions. It was initially developed by Linus. Its version is managed locally and does not need to download the version from the central server as SVN does.

Install git in linux. You can configure Yum and install git directly.

GIt usage tips

Initialize the version library mkdir ~ /Myrepos; git init

Git add file.txt add the files in the workspace to the temporary storage area,

Git commit-m 'create a file' submits the files in the temporary storage area to the version library. The-m option indicates the version prompt.

Git show shows version library changes

Git status displays the current status of the version Library

Git log displays the historical version Library

Git reflog displays historical commands that have been operated and is useful for returning previous versions to future versions.

Git reset hash_id; here, hash_id is the hash id displayed in git log .. This command returns the version indicated by the hash_id.

Git rm file_name indicates that files in the version library are deleted, and git commit indicates that files are submitted for deletion.

Git checkout -- delete_file_name indicates that the deletion is canceled, and no commit is available yet.

Git remote add remote_repos git@github.com: hu/demo represents adding a remote repository named remote_repos.

Git remote-v displays the details of the remote version Library

Git branch displays current version branches

Git checkout-B dev indicates creating a branch and switching to it

Git checkout dev indicates switch Branch

Git merge Dev indicates merging the current Branch

Git push-u remote_repos_name master indicates uploading the local version. If the versions of the two databases are inconsistent or fail. You can use the-f (-- force) option to force merge.

Git pull remote_repos_name pull remote version to local

 

Build a git server,

Create a directory/home/git/project. git

Git -- bare init -- bare indicates that a workspace is not created. As a shared zone, uploaded files cannot be viewed.

Useradd git-s/usr/bin/git-shell; passwd git


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.