我是git的新手,希望能正确使用它.
git init
git add . // added the whole directory
git commit -m "initial stage"
git checkout -b "version1"
git branch
master
* version1
Run Code Online (Sandbox Code Playgroud)
现在我想在目录中添加一些新文件
cp /path/to/file/admin.php /path/to/git/folder/.
Run Code Online (Sandbox Code Playgroud)
这些文件应仅包含在version1分支上,但它也包含在master分支中
git add admin.php
git status
On branch version1
Untracked files:
(use "git add <file>..." to include in what will be committed)
admin.php
git checkout master
git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
admin.php
Run Code Online (Sandbox Code Playgroud)
问题是如何才能在特定分支上添加文件?
谢谢
我正在尝试一个脚本,其中文件[file.txt]有如此多的列
abc|pqr|lmn|123
pqr|xzy|321|azy
lee|cha| |325
xyz| |abc|123
Run Code Online (Sandbox Code Playgroud)
我想用awk命令来获取在bash脚本列清单,如果列为空,应该打印空白的其他打印列值
我尝试了以下可能性,但它无法正常工作
cat file.txt | awk -F "|" {'print $2'} | sed -e 's/^$/blank/' // Using awk and sed
cat file.txt | awk -F "|" '!$2 {print "blank"} '
cat file.txt | awk -F "|" '{if ($2 =="" ) print "blank" } '
Run Code Online (Sandbox Code Playgroud)
请让我知道如何使用awk或任何其他bash工具来做到这一点.
谢谢