在Github上建立一个SVN的镜像库

1.Create repository 创建库

2.clone the git repository 克隆代码至本地

$git clone git@github.com:user-name/repository-name

3.set svn as a remote repository 把svn仓库添加为远程仓库

$git svn init -T http://url/svn/trunk/

4.fetch 获取svn仓库的代码

$git svn fetch

5.show all branch 显示所有分支

$git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/trunk

remotes/trunk is the svn branch 其中,remotes/trunk为svn分支

6.merge 合并svn分支

$git merge trunk

7.push 推送至github

$git push

refference

在GitHub上建立一个SVN仓库的镜像

标签: git
日期: 2014-03-21 17:30:06, 10 years and 301 days ago

sscanf 函数使用中括号格式化字符串

在[]之中的字符串集合可以更好的格式化字符串 a set of characters in brackets ([ ]) can be substituted for the s (string) type character. The set of characters in brackets is referred to as a control string.

  • [^characters] 匹配直到所有非此集合中的字符,直到此集合的字符出现为止。If the first character in the set is a caret (^), the effect is reversed: The input field is read up to the first character that does appear in the rest of the character set.

  • [characters] 匹配直到出现未在此集合中出现的字符input field is read up to the first character that does not appear in the control string

int
main(int argc, char * * a rgv)
{
    char* s = "key= value ";
    char key[1024] = {0};
    char value[1024] = {0};
    char* digits = "pi3.1415926";
    sscanf(s, "%[^=]=%[^\0]", key, value);
    printf("%s\n%s\n", key, value);
    sscanf(digits, "%[abcdefghijklmnopqrstuvwxyz]%[1234567890.]", key, value);
    printf("%s\n%s\n", key, value);
    return 0;
}
标签: c
日期: 2014-03-14 17:30:06, 10 years and 308 days ago

show commit count 显示提交记录数

git rev-list HEAD --count

combine commit or modify commit message 合并或修改记录

  • command 命令
git rebase -i HEAD~$x

其中$x代表你期望操作的记录数,小于提交记录数 $x is the count of commit that you want to combine or change, $x is less than commit count

如 e.g.

你想操作最后十条,则$x为10 if you want to change the last ten commits, the value of $x is 10.

pick 123456 init
pick 7890ab add text
pick cdef12 modify text
pick 345678 modify text

  • edit 编辑

change the "pick" that is in front of the commit line to "s", the commit will combine to previous commit. 在你期望合并的commit将前面的pick更改成s就行, 此条commit将于上一条commit合并

change the "pick to "r", the commit message will be modify. pick改成r表示修改当前提交信息

e.g.例如:

"pick 345678 modify text" --> "s 345678 modify text"

  • change commit message after saving 保存后,重新编写提交信息
 # This is a combination of 2 commits.
 # The first commit's message is:

 modify text

 # This is the 2nd commit message:

 modify text

 # Please enter the commit message for your changes. Lines starting
 # with '#' will be ignored, and an empty message aborts the commit.
 # HEAD detached at 8658d47
 # You are currently editing a commit while rebasing branch 'master' on 'ddcff57'.
 #
 # Changes to be committed:
 #   (use "git reset HEAD^1 ..." to unstage)
 #
 #  new file:   ignorelist
 #  modified:   README.md
 #
 # Untracked files:
 #   (use "git add ..." to include in what will be committed)
 #
 change text

 # Please enter the commit message for your changes. Lines starting
 # with '#' will be ignored, and an empty message aborts the commit.
 # HEAD detached from 18e598b
 # You are currently editing a commit while rebasing branch 'master' on 'ddcff57'.
 #
 # Changes to be committed:
 #   (use "git reset HEAD^1 ..." to unstage)
 #
 #  new file:   README.md
 #
 # Untracked files:
 #   (use "git add ..." to include in what will be committed)
 #
  • push 推送至远程
git push -f
标签: git
日期: 2014-03-07 17:30:06, 10 years and 315 days ago