卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章77026本站已运行4326

git

git

git 是一个强大的版本控制系统,用于跨多个用户管理代码并跟踪不同版本之间的更改。

安装:

从以下路径下载并安装git

https://git-scm.com/download/win

安装后,git 可以通过各种命令用作版本控制系统。
您可以为计算机上的特定文件夹配置 git,从而允许您管理对现有文件的所有更改以及在该文件夹中添加新文件

基本命令:

1. git init:

这将在当前目录中初始化新的存储库。这还会创建 .git 目录并存储所有版本控制信息。

2. git config:
git config --global user.name "ranjith "
git config --global user.mail "ranjith201099@gmail.com"
3. git status

显示工作区域的当前状态,例如已暂存、未跟踪和未暂存。

4. git add

将更改从工作目录添加到暂存区域,准备提交。

to add specific file: git add "filename.py"
to add all changes git add .
5. git commit
git commit -m "<message>"
</message>

使用描述性消息提交分阶段更改

6. git log

显示存储库的提交历史列表。
它将显示提交 id、作者、日期和提交更改
创建分支

git branch <branch_name> - to create branch
</branch_name>
git checkout <branch_name> - to switch to the new branch
</branch_name>
git branch -b <branch_name></branch_name>

创建并切换到分支
gitbranch - 查看所有分支(当前分支将用星号突出显示)

merge a branch:

一旦完成了一个分支上的工作并希望将其集成到另一个分支(例如 master)中,就需要进行合并。

it means all the changes we have made in <branch_name> will be merged with master branch.
first, switch to the branch you want to merge into: git checkout master
</branch_name>
then, use git merge <branch_name> to merge your branch.
</branch_name>
deleting branch
once the code changes in <branch_name> merged into <master> branch, we might need to delete branch.
</master></branch_name>
use git branch -d <branch_name> to delete branch
</branch_name>
卓越飞翔博客
上一篇: CSSseudo-Classes and Pseudo-Elements: An In-Depth Look
下一篇: 返回列表
留言与评论(共有 0 条评论)
   
验证码:
隐藏边栏