zhouzhongyuan / qa

Questions recods
MIT License
5 stars 1 forks source link

git svn 使用指南 #13

Closed zhouzhongyuan closed 7 years ago

zhouzhongyuan commented 7 years ago

官方文档:8.1 Git 与其他系统 - Git 与 Subversion

git clone:

git svn clone 

git update

git svn rebase

git push

git svn dcommit

Error: git svn rebase --> "file.abs: needs update"

  git stash  (save local changes away)
  git stash list (have a look at what is stashed)
  git svn rebase
  git svn dcommit
  git stash apply (back to where we were before) || git stash pop
  git stash apply stash      # apply top of stash stack
  git stash apply stash@{1}  # and mix in next stash stack entry too

或者

两个分支的方法,具体不详。待研究或者给作者写信。

参考How to "git svn dcommit" with uncommitted changes

zhouzhongyuan commented 7 years ago

Git 常用命令

查看分支

git branch

创建dev分支,切换到dev分支

git checkout -b dev
git branch dev
git checkout dev

切换到master分支


git checkout master

合并dev分支

git merge dev

删除dev分支

git branch -d dev

显示最近的三条记录

git log -n 3

2.3 Git Basics - Viewing the Commit History

查看远程分支:

git branch -a

查看远程地址

git remote -v

输出:

origin  git@github.com:bvaughn/react-virtualized.git (fetch)
origin  git@github.com:bvaughn/react-virtualized.git (push)

clone远程分支:

git checkout -b virtualizedlist remotes/origin/virtualizedlist

添加远程地址:

git remote add origin https://github.com/zhouzhongyuan/del.git

creates a new remote called origin located at https://github.com/zhouzhongyuan/del.git. Once you do this, in your push commands, you can push to origin instead of typing out the whole URL.

推送到远程地址:

git push -u origin master

push the commits in the local branch named master to the remote named origin

Global .gitignore

git config --global core.excludesfile ~/.gitignore_global

第一个commit

git log --reverse

查看源代码时必备

zhouzhongyuan commented 7 years ago

svn常用命令

不再bash shell中显示file lists

svn co -q URL

显示最近的三条记录

svn log -l 3

显示某个文件某两个版本的区别

svn diff -r 8979:11390 SelectViewController.m

svn log

切换用户

 rm -rf ~/.subversion/auth 
 svn up  ( it'll ask you for new username & password )

How change default SVN username and password to commit changes?

指定用户提交

svn commit -m "Add Wechat QRPay prepay" --username=zhouzy
zhouzhongyuan commented 7 years ago

Github 常用命令

  1. Git push requires username and password

    A common mistake is cloning using the default (HTTPS) instead of SSH. You can correct this by going to your repository, clicking the ssh button left to the URL field and updating the URL of your origin remote like this

    git remote set-url origin git@github.com:username/repo.git
zhouzhongyuan commented 6 years ago

gitignore

# ignoredist文件件下的所有内容,除了index.html
**/dist/*

!**/dist/index.html
zhouzhongyuan commented 6 years ago

Clone branch

git clone 
git branch -a 
git checkout 
zhouzhongyuan commented 5 years ago

统计命令

统计迭代数量

git log --oneline | wc -l