且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Git分支

更新时间:2022-10-05 08:24:05

查看分支

git branch

命令行输出

Git分支


创建新分支

git branch test1
git branch

命令行输出

Git分支


切换分支

ls
echo 'test' > test1.txt
git add .
git commit -m 'add test1.txt'
ls
git checkout test1
ls
git branch

命令行输出

Git分支


新创建分支并切换分支后在该分支下工作

git checkout -b test2
echo 'test2' > test2.txt
git add .
git commit -m 'add test2.txt'
git branch
ls
git checkout test1
ls

命令行输出

Git分支

Git分支

本文转自 素颜猪 51CTO博客,原文链接:http://blog.51cto.com/suyanzhu/1907167