git init
:初始化git目录git add README.md
:添加文件到暂存区git commit -m "这是注释"
:提交到本地仓库git status
:查看提交状态git diff README.md
:查看不同git log
:查看提交记录,一行查看git log --pretty=oneline
git reset --hard HEAD^
:回退到上一个版本,git reset --hard HEAD~100
,回退100个版本git reflog
:查看版本号git reset --hard 6fcfc89
:恢复到某个版本git checkout -- README.md
:撤销工作区的修改git remote add origin https://github.com/dorianxiao/git_test.git
:新增远程主机git push -u origin master
:第一次把当前分支推送到远程,以后省略-u
git clone https://github.com/dorianxiao/git_test
:克隆到本地git checkout -b dev
:创建并切换到分支,等于git branch dev, git checkout dev
git branch
:查看分支git merge dev
:在master分支上合并dev
分支git branch -d dev
:删除分支git stash
:隐藏当前分支,等其他分支完成后可git stash pop
恢复并删除该stash
git stash apply
:恢复分支但不删除,git stash drop
:删除git stash list
:查看所有stashgit remote
:查看远程库信息,git remote -v
:详细信息git branch -r -d origin/fenzhi1
+git push origin :fenzhi1
:删除远程分支
-
Notifications
You must be signed in to change notification settings - Fork 1
dorianxiao/git_tips
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published