git在分支上建立目錄和文件


建立一個空目錄,在其中初始化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目錄是不可見滴。

相關文章
相關標籤/搜索