svn and git notes

Create a branch:

export url=$(svn info | grep URL | awk '{print $2}') #get url
echo $url
export newurl=$url/../branches/path
svn mkdir --parents $newurl -m 'mkdir of branch'
svn copy $url  $newurl -m 'create branch' # add "-r466" option to branch from specific branch
cd your/local/branch/path
svn co $newurl

# remove branch
svn delete -m "Removing obsolete branch of calc project."

svn log # list all commit records
svn diff -r 455:462 # diff two versions




Git flow:

Git Branching – Basic Branching and Merging
Merging vs. Rebasing


# Merging an upstream repository into your fork
git checkout master # Check out the branch you wish to merge to
git pull BRANCH_NAME # This will pull remote files to local and may conflicts with your modification [ See how to solve conflicts:]
git merge other-branch # Instead of remote filtes, this will merge the other branch in the same repo to current branch 

# Use tool to merge conflict
sudo apt-get install kdiff3
git mergetool --tool=kdiff3

git status; git commit -m 'merge' # Check and commit the merge
git remote -v # check what is origin URL
git push origin master # Push the merge to your GitHub repository.

# diff working copy and a branch
git diff --name-only master . > diff_files.txt
files=$(cat diff_files.txt)
for file in $files; do
 git diff master:$file $file >> master_scnn.diff

git reset HEAD <file> # unstage a file

# track other's (e.g. wenwei202) fork
git remote add wenwei202
git fetch wenwei202 
git checkout --track wenwei202/sfm 
git branch -b sfm wenwei202/sfm
git checkout -b sfm wenwei202/sfm 
git push -u origin sfm 
git pull wenwei202 sfm # merge other's commits

Git diff: