Using Github

git status

this is used for checking the status of local on the current branch.

git fetch origin aRemoteBranchName:targetLocalBranch

this will fetch the remote branch named aRemoteBranchName into local repo with branch name targetLocalBranch

git push origin aLocalBranch:targetRemoteBranch

this will push local branch aLocalBranch into the remote repo of the targetRemoteBranch, the :targetRemoteBranch can omitted if the branch name is the same as local branch.

Squash commits

//squash 3 commit into one, doing following:
git rebase -i HEAD~3
//in the coming edit, replace 'pick' to 's' for the following 2 commits, this will squash them into the first commit
//then 
git rebase --continue

Edit commit message

// a -> b -> c -> d
//to edit the commit message for d, doing following:
git commit --amend
//in the edit interface, just edit the commit message there

//if you want to edit the message for b, doing the following:
git rebase -i HEAD~3
//just save the coming text
//then the b becomes the last commit and c,d is disappeared temporarily
git commit --amend
//edit the message for b
//then rebase back
git rebase --continue

发表评论

电子邮件地址不会被公开。 必填项已用*标注