您的位置:首页 > 其它

git常用命令笔记

2015-05-22 01:14 232 查看
git

git config –global user.name

git config –global user.email

mkdir repository.name

cd repo.name

pwd // show the current path

git init // init the folder to git.repo

git add file.name

git commit -m “commit message”

git status

git diff file.name

git log // check the commit history

git log –pretty=online

(HEAD,HEAD^,HEAD^^,HEAD~100) the latest

git reset –hard commit.idgit reflog // check all command history

workplace | stage | master

git diff HEAD –file.name

git checkout — file.name // repeal all files in workplace, recover all workplace files to the lastert status

git reset HEAD file.name // unstagerm file.name

git rm file.name

git commit -m “remove message file.name”

(another situation of wrong delete)git checkout — rm.filename

ssh-keygen -t rsa -C “41695562@qq.com”

git remote add origin git@github.com:niceforbear/repo_name.git // origin is default name of remote library

git push -u origin master // first use

git push origin master // second and later use

git clone git@github.com:niceforbear/clone_name.git

cd clone_name

ls

git checkout -b branch_name // switched to a new branch

branch_name

git branch branch_name

git check branch_name

git branch // check

git add/commit // all on the * branch

git checkout master // switched to branch ‘master’

git merge branch_name // merge branch_name to current branch

git branch -d branch_name // deleted branch branch_name

git log –graph –pretty=online –abbrev-commit // check merge branch graph

git merge –no-ff -m “merge message with no-ff” branch_name // there is a branch in the history log
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: