您的位置:首页 > 产品设计 > UI/UE

git使用记录

2017-03-15 21:42 190 查看
github的window桌面版本真的没有官网上说的那么好用,eclipse上的egit插件也没有那么稳定,前几天push一个包,本以为推送上去了,但是没想到到公司的电脑上pull下来竟然发现没有之前的东西了(原谅我一直用一个master分支)。

到了公司没办法怕冲突了,有新建了一个分支,push上去了,回到家总算折腾成功合到了一起。

最后删除分支的时候gui版本操作起来很繁琐,很多功能缺失,不得不用命令行,发现还挺好用。所以记录一下。

git status 查看当前项目和分支的状态 十分好用

git branch 查看分支 会以*来显示你当前分支

* 1111
master


git branch 后面会跟上几个修饰符

-d 【name】 用于删除name分支(我就是用这个命令删掉了本地分支的)

git checkout master 切换分支

为什么要用切换分支,因为删除分支的时候还处于那个分支

最好用的当然是git push 虽然有时候反馈信息有些慢,但是好歹有反馈信息啊,egit有时候会直接run in backaround,你就很难确认是否push成功

下面是我操作的过程,记录一下第一次

~\Documents\GitHub\Java-SE-study-code-file [1111 ××]> git branch
* 1111 master
~\Documents\GitHub\Java-SE-study-code-file [1111 ××]> git branch -a
* 1111 master
remotes/origin/HEAD -> origin/master
remotes/origin/TempararyUsebranch
remotes/origin/master
~\Documents\GitHub\Java-SE-study-code-file [1111 ××]> git branch
* 1111 master
~\Documents\GitHub\Java-SE-study-code-file [1111 ××]> git branch -d 1111
error: Cannot delete branch '1111' checked out at 'C:/Users/huxingyue/Documents/
GitHub/Java-SE-study-code-file'
~\Documents\GitHub\Java-SE-study-code-file [1111 ××]> git checkout master
Your branch is up-to-date with 'origin/master'.
Switched to branch 'master'
~\Documents\GitHub\Java-SE-study-code-file [master ≡≡]> git branch
1111
* master
~\Documents\GitHub\Java-SE-study-code-file [master ≡≡]> git branch -d 1111
error: The branch '1111' is not fully merged.
If you are sure you want to delete it, run 'git branch -D 1111'.
~\Documents\GitHub\Java-SE-study-code-file [master ≡≡]> git branch -D 1111
Deleted branch 1111 (was 7790ecf).
~\Documents\GitHub\Java-SE-study-code-file [master ≡≡]> git push
Everything up-to-date
~\Documents\GitHub\Java-SE-study-code-file [master ≡≡]>
~\Documents\GitHub\Java-SE-study-code-file [master ≡]>


git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]


These are common Git commands used in various situations:

start a working area (see also: git help tutorial)

clone Clone a repository into a new directory

init Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)

add Add file contents to the index

mv Move or rename a file, a directory, or a symlink

reset Reset current HEAD to the specified state

rm Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)

bisect Use binary search to find the commit that introduced a bug

grep Print lines matching a pattern

log Show commit logs

show Show various types of objects

status Show the working tree status

grow, mark and tweak your common history

branch List, create, or delete branches

checkout Switch branches or restore working tree files

commit Record changes to the repository

diff Show changes between commits, commit and working tree, etc

merge Join two or more development histories together

rebase Reapply commits on top of another base tip

tag Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)

fetch Download objects and refs from another repository

pull Fetch from and integrate with another repository or a local branch

push Update remote refs along with associated objects

‘git help -a’ and ‘git help -g’ list available subcommands and some

concept guides. See ‘git help ’ or ‘git help ’
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git github gui