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