Home > Operation and Maintenance > Linux Operation and Maintenance > How to install git and common git commands on linux

How to install git and common git commands on linux

WBOY
Release: 2023-05-28 21:58:04
forward
1197 people have browsed it

1. Install git

$  sudo aptitude install git
$  sudo aptitude install git-doc git-svn git-email git-gui gitk
Copy after login

The git software package contains most of the git commands and is a must-install software package. The second line of commands is also a git software package, but it is released separately. You can Select Install.

2. Download the git library of the remote project to the local

[code]
$  git clone git://远程git库地址  filename
[code]
Copy after login

filename is the name of your local folder. Clone the remote library to this folder. This file is created by yourself.

3. Commonly used commands

(1)git branch  查看本地分支
(2)git branch -a        查看远程分支
(3)git checkout  branchname       切换分支 
(4)git add yourfile     
(5)git commit -a -m "描述"      提交你当前开发到暂存区,可以理解为你本地的git库
(6)git pull   更新,如果几个人同时在一个分枝上开发,可能会造成不同步,造成自己本地的git库落后或提前远程git库,这时候就要更新自己本地的库。
(7)git push 提交,将自己开发的代码提交到对应的远程分之上去
(8)git status  查看工作区状态,及查看在此分支上进行了那些操作
(9)git log  查看操作日志,还是挺有用的
(10)git merge 合并分支,自己开发的模块最终要合并到项目的总分枝上去,这是要先切换到项目总分支,然后 git merge 自己的分支
(11)git branch -d/d   yourbranch  删除本地分支
(12)git push origin :yourbranch    删除远程分支
Copy after login

What versions of Linux are there?

Linux versions include: Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and other versions. Among them, Deepin is one of the best-developed Linux distributions in China; Ubuntu Kylin is a derivative distribution based on Ubuntu; Manjaro is a Linux distribution based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP and is simple and easy to use; Ubuntu is a desktop application Mainly Linux operating system.

The above is the detailed content of How to install git and common git commands on linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template