Git


1.get the git repository
git init (use git manage the project, this command will generate
the .git directory)
git clone [url] [directory](checkout the repository from the specified
url )

2.record the update
git status
git add [file name] (untracked to staged / modified to staged)
git checkout [file name](discard the changes in working directory)
git diff [file name](compare the working directory with staged file)
git diff --cached / --staged [file name](compare the staged file with
the last commit snapshot)
git commit [file name](commit staged file)
git commit -a [file name](commit tracked file)
git rm [file name](remove the staged file)
git rm --cached [file name](remove the staged file but leave it in the
working directory)
git mv file_from file_to (modify file name in the git)

3.view the commit history
git log (list all the commit log order by the commit time)
git log -p -2(-p list the difference between every commit
              -2  display the recent two record)
git log --stat(display the modify like statistics)
git log --pretty=format:"%h - %an, %ar : %s"(display the record in the
specified format)
gitk(graphical tool)

4.destruction operation
git commit --amend(modify the last commit information)
git reset HEAD <file>(return the staged file back to untracked files)

5.how to use remote repository
git remote (display remote repository name)
git remote -v (display the remote repository url)
git remote add [shortname] [url] (add a new remote repository )
git fetch [remote-name](fetch data from the remote repository )
git push [remote-name] [branch-name] (push data to the remote
repository)
git remote show [remote-name] (display remote repository detail
information)
git remote rename [file_from] [file_to](change the remote repository
name)
git remote rm paul [file_name](remove the remote repository)

6.tag
git tag(display all tag)
git tag -a [tag name] -m [tag information](-a annotated tag     -m
explain the tag)
git show [tag name]

7.misc
git branch -a(list all branch)
git branch [branch name](create a new branch)
git checkout [branch name] (switch the branch)
git checkout -b [branch name](switch to a new branch)
git branch -d [branch name](delete the specified branch)
git merge [branch name] (merge this branch to the current branch)
git mergetool -t tkdiff (use merge tool tkdiff to merge the conflict
file)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值