Github使用过程记录

来源:互联网 发布:中仕网络 编辑:程序博客网 时间:2024/05/17 08:22

0. clone repository:

git clone --recursive https://github.com/xqzhang2015/vimconfig



1. 添加/修改 文件

git add README.md
git status
git commit -m "modeify the README.md to add some commands"
git status
git push


2.添加submodule



3. github版本回滚

git log
git reset --hard 48e474a39781df681366247889a88b0c5beecc50
git status
git push -f
git status
重新修改并提交文件:

git add install.sh
git commit -m "more auto"
git push



3.修改文件记录

<span style="font-size:18px;">➜  vimconfig git:(master) ✗ git commit -m "modified vimrc configure file"On branch masterYour branch is up-to-date with 'origin/master'.Changes not staged for commit:modified:   .vimrcmodified:   vimrcUntracked files:.gitmodules.oldno changes added to commit➜  vimconfig git:(master) ✗ git add .vimrc➜  vimconfig git:(master) ✗ git add vimrc➜  vimconfig git:(master) ✗ git statusOn branch masterYour branch is up-to-date with 'origin/master'.Changes to be committed:  (use "git reset HEAD <file>..." to unstage)modified:   .vimrcmodified:   vimrcUntracked files:  (use "git add <file>..." to include in what will be committed).gitmodules.old==================================================➜  vimconfig git:(master) ✗ git pushwarning: push.default is unset; its implicit value has changed inGit 2.0 from 'matching' to 'simple'. To squelch this messageand maintain the traditional behavior, use:  git config --global push.default matchingTo squelch this message and adopt the new behavior now, use:  git config --global push.default simpleWhen push.default is set to 'matching', git will push local branchesto the remote branches that already exist with the same name.Since Git 2.0, Git defaults to the more conservative 'simple'behavior, which only pushes the current branch to the correspondingremote branch that 'git pull' uses to update the current branch.See 'git help config' and search for 'push.default' for further information.(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode'current' instead of 'simple' if you sometimes use older versions of Git)Counting objects: 3, done.Delta compression using up to 8 threads.Compressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 653 bytes | 0 bytes/s, done.Total 3 (delta 2), reused 0 (delta 0)To https://github.com/xqzhang2015/vimconfig   b59f60d..b7fa29d  master -> master➜  vimconfig git:(master) ✗ git status </span>

<span style="font-size:18px;">[xqzhang@PEKdev032 ~/NHT201507/test_git/vimconfig]$ git pull -recurse-submoduleserror: did you mean `--recurse-submodules` (with two dashes ?)[xqzhang@PEKdev032 ~/NHT201507/test_git/vimconfig]$ git pull --recurse-submodules</span>


【注】正常命令

git remote add origin https://github.com/zhchnchn/VimConfig.gitgit push -u origin master


4.vimrc配置文件路径 使用脚本自动替换

[xqzhang@PEKdev032 ~/NHT201507/test_git/vimconfig]$ sed -i "s/PATH_VIM/${PATH_VIMCONFIG}/g" vimrc
sed: -e expression #1, char 13: unknown option to `s'

改为:

[xqzhang@PEKdev032 ~/NHT201507/test_git/vimconfig]$ sed -i "s%PATH_VIM%${PATH_VIMCONFIG}%g" vimrc

【注】问题解决参考资料

<span style="font-size:18px;">百思不得其解之下,我做了一些尝试,终于发现,如果使用“%”而不是“/”来作为sed的替换操作的分隔符,就不会出错。代码如下:#!/bin/shPWD=`pwd`DEF_FILE="t1.def"cat $DEF_FILE | sed "s%WKDIR=.*%WKDIR=$PWD%g" #> $DEF_FILEexit 0最后终于发现,问题就出在这个“/”,因为路径里面包含有“/”作为分隔符,这会和sed的替换操作的分隔符“/”引起混淆;所以,只要不使用“/”做分隔符就可以解决这个问题。</span>







0 0
原创粉丝点击