How to use git for version control in the PHPYii framework-php Tutorial

Source: Internet
Author: User
Tags how to use git
In the PHPYii framework, you can use git for version control. Git defines on Wikipedia: it is a free, distributed version control tool, or a source code management tool that emphasizes high speed. Git was initially developed by Linus Torvalds for Linux kernel management. Each Git working directory is a completely independent code library with complete history and version tracking capabilities, independent of the network and central server.
Some commands and commands related to git version control.


Initialize two basic commands
Git init. creates a version Library under the current directory.


Git clone git: // github.com/someone/some_project.git some_project

The original remote version Library is completely cloned to the local some_project directory.


Git remote add orgin git: // github.com/someone/another_project.git



Git command to view remote repository
Git remote-v


Update the code of the origin database version to the local master branch.


Git pull origin master // update the local git repository


Command composer update-o-vvv for matching relationship


Create a virtual directory


Cd/etc


Configure the virtual directory by editing and saving the files in the server


Then, you can edit the hosts file in the server to direct the virtual path to the local device.
Restart the service:
Service nginx (server name) restart
Update git-related commands:

View commands related to the local database: git status (view the status of the local database)


Add to local database:

Git add-

Git add-
Git commit-a-m "upadte"

Command for uploading to server:

Git push origin master


Commands for downloading updates to the local database:

Git pull origin master



# Initializing a version repository
Git init


# Clone remote version Library
Git clone git@xbc.me: wordpress. git


# Add the remote repository origin with the syntax git remote add [shortname] [url]
Git remote add origin git@xbc.me: wordpress. git


# Viewing remote repositories
Git remote-v




# Add the modified file to the temporary storage area
Git add.


# If you automatically track files, including those that have been manually Deleted and are in the Deleted status
Git add-u


# Submit your modifications
Git commit? M "your comment"


# Push your updates to the remote server. Syntax: git push [remote name] [local branch]: [remote branch]
Git push origin master


# Viewing file status
Git status


# Tracking new files
Git add readme.txt


# Remove files from the current trail list and delete all files
Git rm readme.txt


# Delete files only in the temporary storage area, keep files in the current directory, and stop tracking
Git rm? Cached readme.txt


# Renaming a file
Git mv reademe.txt readme


# Viewing submitted history
Git log


# Modify the comment submitted last time by using? Amend parameter
Git commit -- amend


# If you forget to submit some modifications, only one of the following three commands will be submitted.
Git commit? M "add readme.txt"
Git add readme_forgotten
Git commit? Amend


# Suppose you have used git add. to add the modified files a and B to the temporary storage zone


# Now you only want to submit file a and file B. This should be the case.
Git reset HEAD B


# Cancel file modification
Git checkout? -Readme.txt

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.