Home Backend Development PHP Tutorial PHP Yii框架中使用git进行版本控制的一下知识

PHP Yii框架中使用git进行版本控制的一下知识

Jun 23, 2016 pm 01:50 PM
git php yii control Knowledge

Git在Wikipedia上的定义:它是一个免费的、分布式的版本控制工具,或是一个强调了速度快的源代码管理工具。Git最初被Linus Torvalds开发出来用于管理Linux内核的开发。每一个Git的工作目录都是一个完全独立的代码库,并拥有完整的历史记录和版本追踪能力,不依赖 于网络和中心服务器。
git版本控制的相关的一些指令和命令。


初始化  两个基本的命令
git init .  就是在当前的目录下建立一个版本库


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

就是将原来的远程版本库完全克隆到本地some_project目录下


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



git查看远程仓库的命令
git remote -v


将origin这个版本库的代码更新到本地的master主支 


git pull origin master//更新本地的git库


解决匹配关系的命令   composer update -o -vvv


建立虚拟目录 


cd /etc


通过编辑保存server里面的文件来配置虚拟目录


然后通过编辑服务器里面的hosts文件来将要建立的虚拟路径指向本地即可
重启服务:
service nginx(服务器名称) restart
更新git的相关的命令:
 
查看本地库的相关的命令:  git status (查看本地库的相关状态)


添加到本地的库:

             git add -a 

              git add -A
              git commit -a -m "upadte"

上传到服务器的命令:

git push origin master


下载到本地库更新的命令:

git pull origin master



#初始化一个版本仓库
git init


#Clone远程版本库
git clone git@xbc.me:wordpress.git


#添加远程版本库origin,语法为 git remote add [shortname] [url]
git remote add origin git@xbc.me:wordpress.git


#查看远程仓库
git remote -v




#添加当前修改的文件到暂存区
git add .


#如果你自动追踪文件,包括你已经手动删除的,状态为Deleted的文件
git add -u


#提交你的修改
git commit ?m "你的注释"


#推送你的更新到远程服务器,语法为 git push [远程名] [本地分支]:[远程分支]
git push origin master


#查看文件状态
git status


#跟踪新文件
git add readme.txt


#从当前跟踪列表移除文件,并完全删除
git rm readme.txt


#仅在暂存区删除,保留文件在当前目录,不再跟踪
git rm ?cached readme.txt


#重命名文件
git mv reademe.txt readme


#查看提交的历史记录
git log


#修改最后一次提交注释的,利用?amend参数
git commit --amend


#忘记提交某些修改,下面的三条命令只会得到一个提交。
git commit ?m "add readme.txt"
git add readme_forgotten
git commit ?amend


#假设你已经使用git add .,将修改过的文件a、b加到暂存区


#现在你只想提交a文件,不想提交b文件,应该这样
git reset HEAD b


#取消对文件的修改
git checkout ?- readme.txt
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

What libraries are used for floating point number operations in Go? What libraries are used for floating point number operations in Go? Apr 02, 2025 pm 02:06 PM

The library used for floating-point number operation in Go language introduces how to ensure the accuracy is...

Which libraries in Go are developed by large companies or provided by well-known open source projects? Which libraries in Go are developed by large companies or provided by well-known open source projects? Apr 02, 2025 pm 04:12 PM

Which libraries in Go are developed by large companies or well-known open source projects? When programming in Go, developers often encounter some common needs, ...

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

Python hourglass graph drawing: How to avoid variable undefined errors? Python hourglass graph drawing: How to avoid variable undefined errors? Apr 01, 2025 pm 06:27 PM

Getting started with Python: Hourglass Graphic Drawing and Input Verification This article will solve the variable definition problem encountered by a Python novice in the hourglass Graphic Drawing Program. Code...

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

How to specify the database associated with the model in Beego ORM? How to specify the database associated with the model in Beego ORM? Apr 02, 2025 pm 03:54 PM

Under the BeegoORM framework, how to specify the database associated with the model? Many Beego projects require multiple databases to be operated simultaneously. When using Beego...

See all articles