跳至主要内容

博文

git fetch pull differences

Git中从远程的分支获取最新的版本到本地有这样2个命令: 1.  git fetch :相当于是从远程获取最新版本到本地,不会自动merge      Git fetch origin master git log - p master .. origin / master git merge origin / master     以上命令的含义:    首先从远程的origin的master主分支下载最新的版本到origin/master分支上    然后比较本地的master分支和origin/master分支的差别    最后进行合并    上述过程其实可以用以下更清晰的方式来进行: git fetch origin master : tmp git diff tmp  git merge tmp     从远程获取最新的版本到本地的test分支上    之后再进行比较合并 2.  git pull :相当于是从远程获取最新版本并merge到本地 git pull origin master 上述命令其实相当于git fetch 和 git merge 在实际使用中,git fetch更安全一些 因为在merge前,我们可以查看更新情况,然后再决定是否合并 结束

shell vs bat

事实上, 残废的DOS批处理文件语言还是可以编写出一些比较强大的脚本来的, 虽然它们一般都需要借助于外部的工具. 所以说, 某些时候, 我们还是需要将老式的DOS批处理文件转换为UNIX shell脚本. 一般来说, 做这种事情并不困难, 因为DOS批处理文件操作不过是等价的shell脚本的一个受限子集.  批处理文件操作符 Shell脚本等价符号 含义 % $ 命令行参数前缀 / - 命令选项标记 \ / 目录路径分隔符 == = (等于)字符串比较测试 !==! != (不等)字符串比较测试 | | 管道 @ set +v 不打印当前命令 * * 文件名"通配符" > > 文件重定向(覆盖) >> >> 文件重定向(附加) < < 重定向stdin %VAR% $VAR 环境变量 REM # 注释 NOT ! 取反 NUL /dev/null "黑洞"用来阻止命令输出 ECHO echo 打印(Bash中有更多选项) ECHO. echo 打印空行 ECHO OFF set +v 不打印后续的命令 FOR %%VAR IN (LIST) DO for var in ; do "for"循环 :LABEL 没有等价物(多余) 标签 GOTO 没有等价物(使用函数) 跳转到脚本的另一个位置 PAUSE sleep 暂停或等待一段时间 CHOICE case or select 菜单选择 IF if if条件语句 IF EXIST FILENAME if [ -e filename ] 测试文件是否存在 IF !%N==! if [ -z "$N" ] 参数"N"是否存在 CALL source命令或.(点操作符) "include"另一个脚本 COMMAND /C source命令或.(点操作符) "include"另一个脚本(与CALL相同) SET export 设置一个环境变量 SHIFT shift 左移命令行参数列表 SGN -lt或-gt (整形)符号 ERRORLEVEL $? 退出状态 CON stdin "控制台"(stdin) PRN /d...

How can I create a Windows bootable USB stick using Ubuntu?

even other Linux distros as long as  GParted  and  GRUB  are installed. Install GParted and GRUB on Ubuntu with: sudo apt-get install gparted grub-pc-bin p7zip-full ntfs-3g For BIOS: MBR partition scheme Rewrite the partition table as  msdos  and format your USB drive as  NTFS  using GParted (and then "Manage flags" and add the  boot  flag). In GParted, right click the USB partition and select  Information . Copy the UUID somewhere as you will need it. Copy all files from mounted Windows ISO or DVD to USB drive using your favorite file manager. Go to USB drive and if the folder named  boot  has uppercase characters, make them all lowercase by renaming it. Install GRUB on USB: sudo grub-install --target=i386-pc --boot-directory="/<USB_mount_folder>/boot" /dev/sdX Create a GRUB config file in the USB drive folder  boot/grub  with the name  grub.cfg . Write this into the file: echo "If...