Play with Git
The biggest difference between distributed and centralized is that developers can submit to local, and each developer copies one on the local machine by cloning (git clone)
complete Git repositories. Compared with the SVN centralized code management that most of us have used, git is more secure for managing code. If the svn server hangs up,
Then its data is likely to be in danger of being lost, but for git, there is no such thing. The code is all git to local, even if the server hangs up,
The code is still intact. Git is a version controller, which is completely different from the traditional svn. svn is a difference comparison, and code cannot be submitted offline. And git saves
With the complete code base local, the code is more secure. Code can be submitted at any time. I have already introduced to you how to build a git server. Next I will
Let’s take a look at the specific use of git commands! I will introduce some commonly used ones here, and for the rest I will recommend a website to everyone, which has a detailed introduction to git
Shao, if you forget, you can check it at any time!
The installation method on windows is to download a git client called git bash tool and install it directly! You can also download the git version of Little Turtle! I’ll introduce it here
is git bash, so that everyone can become familiar with git commands.
The installation method under Linux is simpler, just yum -y install git!
We created a new project TestProject
on the serverFirst, you will be assigned a group and username and password, which means you have permission to access this project. Our first step is to set up our username and email address.
Create a new folder to store the project, enter the file, right-click and select Git Bash Here to enter our git command line interface. The next operation will be performed inside.
git config -l (view configuration file)
The first case is that the project is uploaded in advance, we only need to pull it locally and use git clone http://172.16.81.91/oe/TestProject.git (equivalent to svn checkout)
git status Check the status of the code at any time, a very useful command
Next let’s modify the test1 file and check the status
Prompt test1 has been modified, then we need to use git add or git commit -a to submit the code
git add. Add modified files to git operation; git commit (submit code, usually followed by -m parameter, indicating adding comments)
The current status of git status is git push (when we complete the submission, we can upload the code to the server)
Let’s go to the server to view the submitted code
Submission completed!
The second situation is that the project files on our server are deleted. We can use git pull locally to update to the latest files (equivalent to svn update)
In the third case, to submit the code to the newly created empty project, we delete the TestProject project from the server and create it again.
We re-create a folder in the TestP directory, name it project2, and create the test1 file in the directory
We need to initialize the folder git init before uploading the local code to the server
Add local code to the remote server git remote add origin http://172.16.81.91/oe/TestProject.git
Submit code
Upload code
View server project verification
The above introduction is what we commonly use. Next, you can check other commands:
查看分支:git branch 创建分支:git branch name 切换分支:git checkout name 创建+切换分支:git checkout –b name 合并某分支到当前分支:git merge name 删除分支:git branch –d name
Finally, I will introduce you to a website with detailed information about git: https://git-scm.com/book/zh/v2
You can also download the pdf of the website and read it locally. After reading the first few pictures, you will be a master!
Please point out any errors! Thanks! Let’s learn together!
The above is the detailed content of Play with Git. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

To restart the Apache server, follow these steps: Linux/macOS: Run sudo systemctl restart apache2. Windows: Run net stop Apache2.4 and then net start Apache2.4. Run netstat -a | findstr 80 to check the server status.

Apache cannot start because the following reasons may be: Configuration file syntax error. Conflict with other application ports. Permissions issue. Out of memory. Process deadlock. Daemon failure. SELinux permissions issues. Firewall problem. Software conflict.

This guide will guide you to learn how to use Syslog in Debian systems. Syslog is a key service in Linux systems for logging system and application log messages. It helps administrators monitor and analyze system activity to quickly identify and resolve problems. 1. Basic knowledge of Syslog The core functions of Syslog include: centrally collecting and managing log messages; supporting multiple log output formats and target locations (such as files or networks); providing real-time log viewing and filtering functions. 2. Install and configure Syslog (using Rsyslog) The Debian system uses Rsyslog by default. You can install it with the following command: sudoaptupdatesud

Steps to fix the Apache vulnerability include: 1. Determine the affected version; 2. Apply security updates; 3. Restart Apache; 4. Verify the fix; 5. Enable security features.

Upgrading the Zookeeper version on Debian system can follow the steps below: 1. Backing up the existing configuration and data Before any upgrade, it is strongly recommended to back up the existing Zookeeper configuration files and data directories. sudocp-r/var/lib/zookeeper/var/lib/zookeeper_backupsudocp/etc/zookeeper/conf/zoo.cfg/etc/zookeeper/conf/zookeeper/z

How to fix Nginx 403 Forbidden error? Check file or directory permissions; 2. Check .htaccess file; 3. Check Nginx configuration file; 4. Restart Nginx. Other possible causes include firewall rules, SELinux settings, or application issues.
