建立一个空目录,在其中初始化gitgit
git initit
建立一个新文件,此时默认在master分支上ast
touch file1.txtfile
add到staging areatouch
git add file1.txtdi
提交变化文件
git commit -m 'the first commit'co
建立一个新的分支block
git branch newBranchnew
切换到新的分支
git checkout newBranch
在新的分支newBranch下建立目录和文件
mkdir folder
touch folder/file2.txt
在新的分支newBranch下add刚添加的目录和文件
git add folder
提交变化
git commit -m 'second commit'
来到默认分支
git checkout master 此时,在newBrach分支上建立的folder目录是不可见滴。