Androizend studio 本地调试怎么查看本地变更历史history

8000人阅读
android 开发工具(3)
android studio/eclipse(3)
Android开发(291)
在使用git pull代码时,经常会碰到有冲突的情况,提示如下信息:
error: Your local changes to 'c/environ.c' would be overwritten by merge.
Please, commit your changes or stash them before you can merge.
这个意思是说更新下来的内容和本地修改的内容有冲突,先提交你的改变或者先将本地修改暂时存储起来。
处理的方式非常简单,主要是使用git stash命令进行处理,分成以下几个步骤进行处理。
1、先将本地修改存储起来
$ git stash
这样本地的所有修改就都被暂时存储起来 。是用git stash list可以看到保存的信息:
git stash暂存修改
其中stash@{0}就是刚才保存的标记。
2、pull内容
暂存了本地修改之后,就可以pull了。
$ git pull
3、还原暂存的内容
$ git stash pop stash@{0}
系统提示如下类似的信息:
Auto-merging c/environ.c
CONFLICT (content): Merge conflict in c/environ.c
意思就是系统自动合并修改的内容,但是其中有冲突,需要解决其中的冲突。
4、解决文件中冲突的的部分
打开冲突的文件,会看到类似如下的内容:
git冲突内容
其中Updated upstream 和=====之间的内容就是pull下来的内容,====和stashed changes之间的内容就是本地修改的内容。碰到这种情况,git也不知道哪行内容是需要的,所以要自行确定需要的内容。
解决完成之后,就可以正常的提交了。
先看个例子:
仅仅想看最近谁有提交,以及提交的描述
对应命令&gitlog
显示Sample
commitfd6c9a3&
Author:XXX&
Date:&& Thu Nov 3 11:38:15 2011 +0800
&&&&fillauthor information in the head of files and format some code
commit8e8a4a96e134dab8f045937efee35bd&
Author:XXX&
Date:&& Thu Nov 3 04:05:34 2011 +0800
&&&&usermanagement is mostly complete
&&&&details:&
&&&add support for account disable/enable&
&&&rewrite most related views to suit the above need&
&&&provide two decorators for access control (see README)&
&&&fixed many errors in Milestone 1
commitd8ad043d0da426a1&
Author:XXX&
Date:&& Mon Oct 17 20:19:04
&&&&fixthe bug of get_ori_url_from_shorturl().
commitb6cdd881a19ecaff838db7058fdd498a&
Author:XXX&
Date:&& Mon Oct 17 20:17:37
&&&&fixthe bug of get_article_from_short_url.
仅仅想看最后一次的提交
对应命令参数-n1
显示Sample
commitfd6c9a3&
Author: XXX&
Date:Thu Nov 3 11:38:15 2011 +0800
fillauthor information in the head of files and format some code
想看到最近一次提交所有更改过的文件
对应命令&gitlog
-n 1 --stat
显示Sample
commitfd6c9a3&
Author:XXX&
Date:&& Thu Nov 3 11:38:15 2011 +0800
&&&&fillauthor information in the head of files and format some code
Site/accounts/decorators.py&&&&&&&&&&&&&&&&&&&&&&&|&&& 2+-&
Site/accounts/forms.py&&&&&&&&&&&&&&&&&&&&&&&&&&&&|&&& 1+&
Site/accounts/models.py&&&&&&&&&&&&&&&&&&&&&&&&&&&|&&& 1+&
Site/accounts/readme&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&|&&& 3++-&
Site/accounts/templates/account_activate.html&&&&&|&&& 1+&
Site/accounts/templates/account_disabled.html&&&&&|&&& 1 +&
28files changed, 37 insertions(+), 8 deletions(-)
想看到最近一次提交所有更改的细节
对应命令&gitlog
显示Sample
commitfd6c9a3&
Author:XXX&
Date:&& Thu Nov 3 11:38:15 2011 +0800
&&&&fillauthor information in the head of files and format some code
diff--git a/Site/accounts/decorators.pyb/Site/accounts/decorators.py&
index 22522bc..a6bb&
--- a/Site/accounts/decorators.py&
+++b/Site/accounts/decorators.py&
@@ -1,9 +1,9@@&
#!/usr/bin/env python&
# -*- coding: utf-8-*-&
+# author: Rex Nov. 3, 2011&
from functoolsimport wraps&
from django.core.urlresolvers importreverse&
from django.http import HttpResponseRedirect&
-fromdjango.utils.decorators import available_attrs&
fromSite.accounts.models import UserProfile
deflogin_required(view_func):&
diff --gita/Site/accounts/forms.py b/Site/accounts/forms.py&
index016710b..778d92a 100755&
--- a/Site/accounts/forms.py&
+++b/Site/accounts/forms.py&
@@ -1,5 +1,6 @@&
#!/usr/bin/envpython&
# -*- coding: utf-8 -*-&
+# author: Rex Nov.3, 201
如果不带任何参数,它会列出所有历史记录,最近的排在最上方,显示提交对象的哈希值,作者、提交日期、和提交说明。如果记录过多,则按Page Up、Page Down、↓、↑来控制显示;按q退出历史记录列表。git log命令后的例子:
commitfd6c9a3&
Author:XXX&
Date:&& Thu Nov 3 11:38:15 2011 +0800
&&&&fillauthor information in the head of files and format some code
commit8e8a4a96e134dab8f045937efee35bd&
Author:XXX&
Date:&& Thu Nov 3 04:05:34 2011 +0800
&&&&usermanagement is mostly complete
&&&&details:&
&&&add support for account disable/enable&
&&&rewrite most related views to suit the above need&
&&&provide two decorators for access control (see README)&
&&&fixed many errors in Milestone 1
commitd8ad043d0da426a1&
Author:XXX&
Date:&& Mon Oct 17 20:19:04
&&&&fixthe bug of get_ori_url_from_shorturl().
commitb6cdd881a19ecaff838db7058fdd498a&
Author:XXX&
Date:&& Mon Oct 17 20:17:37
&&&&fixthe bug of get_article_from_short_url.
2.git log -n
如果不想向上面那样全部显示,可以选择显示前N条。
想看到最近一次提交所有更改过的文件
显示Sample
commitfd6c9a3&
Author: XXX&
Date:Thu Nov 3 11:38:15 2011 +0800
fillauthor information in the head of files and format some code
3.git log --stat -n
显示简要的增改行数统计,每次提交文件的变更统计,-n 同上,前n条,可省略。
commit d0b9a20fac8abcc0fbb1d488f309bf5
Author: BeginMan &&
Sat Mar 1 23:26:43 2014 +0800
_posts/2014-02-27-Customizing-Git.md | 5 +++++
1 file changed, 5 insertions(+)
commit 8c186cdeae6df7de880b99efa0f87cf
Author: BeginMan &&
Sat Mar 1 23:26:10 2014 +0800
_posts/2014-02-27-Customizing-Git.md | 56 +++++++++++++++++++++++++++++++++++-
1 file changed, 55 insertions(+), 1 deletion(-)
每个提交都列出了修改过的文件,以及其中添加和移除的行数,并在最后列出所有增减行数小计,比如上面的有5行做了更新。
4.git log -p -n
此命令同上,不过显示更全了。
5.git log --pretty=oneline
一行显示,只显示哈希值和提交说明。
6.gig lot --graph
ASCII 字符串表示的简单图形,形象地展示了每个提交所在的分支及其分化衍合情况
$ git log --pretty=format:&%h %s& --graph
7.$ git log --pretty=format:& &
控制显示的记录格式,常用的格式占位符写法及其代表的意义如下:
提交对象(commit)的完整哈希字串
提交对象的简短哈希字串
树对象(tree)的完整哈希字串
树对象的简短哈希字串
父对象(parent)的完整哈希字串
父对象的简短哈希字串
作者(author)的名字
作者的电子邮件地址
作者修订日期(可以用 -date= 选项定制格式)
作者修订日期,按多久以前的方式显示
提交者(committer)的名字
提交者的电子邮件地址
提交日期,按多久以前的方式显示
如下操作:
$ git log --pretty=format:&%h -%an,%ar : %s& -3
d0b9a20 -BeginMan,24 hours ago : ok
8c186cd -BeginMan,24 hours ago : mi
b2a3100 -BeginMan,24 hours ago : what?
显示了前3条的信息,简单的哈希值,作者,提交时间,提交说明。
个人感觉这个命令挺好的,为了方面使用,还是做个别名吧:
$ git config alias.logs &log --pretty=format:'%h -%an,%ar:%s'&
$ git config alias.logs
log --pretty=format:'%h -%an,%ar:%s'
$ git logs
8.指定路径
比如说,指定项目路径下的所有以install.md结尾的文件的提交历史:
只需要加上文件路径作为参数即可。
9.指定日期、关键字、作者
如两天前的提交历史:git log --since=2.days
如指定作者为&BeginMan&的所有提交:$ git log --author=BeginMan
如指定关键字为“init”的所有提交:$ git log --grep=init
如指定提交者为&Jack&的所有提交:$ git log --committer=Jack
注意作者与提交者的关系:作者是程序的修改者,提交者是代码提交人。
如指定2天前,作者为“BeginMan”的提交含有关键字'init'的前2条记录:$ git log --since=2.days --author=BeginMan --grep=init -2
注意:上面选项后面的参数可以带单双引号,如--author=&BeginMan&
使用说明如下:
-(n) 仅显示最近的 n 条提交
--since, --after 仅显示指定时间之后的提交。
--until, --before 仅显示指定时间之前的提交。
--author 仅显示指定作者相关的提交。
--committer 仅显示指定提交者相关的提交。
来看一个实际的例子,如果要查看 Git 仓库中,2008 年 10 月期间,Junio Hamano 提交的但未合并的测试脚本(位于项目的 t/ 目录下的文件),可以用下面的查询命令:
$ git log --pretty=&%h - %s& --author=gitster --since=&& \
--before=&& --no-merges -- t/
git log 命令支持的选项
-p 按补丁格式显示每个更新之间的差异。
--stat 显示每次更新的文件修改统计信息。
--shortstat 只显示 --stat 中最后的行数修改添加移除统计。
--name-only 仅在提交信息后显示已修改的文件清单。
--name-status 显示新增、修改、删除的文件清单。
--abbrev-commit 仅显示 SHA-1 的前几个字符,而非所有的 40 个字符。
--relative-date 使用较短的相对时间显示(比如,“2 weeks ago”)。
--graph 显示 ASCII 图形表示的分支合并历史。
--pretty 使用其他格式显示历史提交信息。可用的选项包括 oneline,short,full,fuller 和 format(后跟指定格式)。
10.git 图形客户端的使用
使用gitk图形客户端查看历史记录。输入$ gitk即可打开,如下:
如果是Linux平台下,可推荐如下:
11.终极之道
终极之道就是查看帮助,如下打开文档查看,前提是英文要好。
$ git log --help
Launching default browser to display HTML ...
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1119931次
积分:11401
积分:11401
排名:第839名
原创:151篇
转载:263篇
评论:200条
(1)(12)(5)(1)(2)(1)(1)(7)(15)(3)(8)(6)(3)(27)(22)(25)(4)(6)(7)(7)(2)(2)(13)(8)(3)(2)(2)(11)(2)(3)(3)(14)(6)(7)(11)(1)(6)(9)(19)(14)(3)(7)(10)(3)(4)(7)(6)(14)(13)(4)(4)(22)(3)(6)(6)Android studio查看本地变更历史history的方法
作者:佚名
字体:[ ] 来源:互联网 时间:01-07 16:04:44
Android studio怎么查看本地变更历史history?提交到仓库中的代码怎么管理,之前我们介绍过git的使用方法,今天我们来看看查看本地变更历史的方法,需要的朋友可以参考下
在Android studio有集成了相当多工具,那么都是在没有网络的情况,也是可以进行对代码管理,都是进行git的对代码库上的管理,那么在使用Android studio就可以进行提交到了本地的仓库中,也可以使用进行查看本地变更历史的信息,那么怎么查看本地变更历史
1、进行选中的Android studio的一个Android的项目,进行选中其中的项目的文件。
2、然后进行选中的文件,进行使用右键的方式,弹出了的下拉菜单中进行选择一个为local history的选项。
3、然后就会弹出了下一级菜单中,进行选择一项为&show history&的选项即可。
4、在local history中就可以查看到当前的文件提交到本地仓库的历史信息,选中的历史文件之后,都会与当前的文件,进行对比文件。
5、进行选中该文件之后,然后进行点击Android studio菜单中的&CVS&的选项
6、这样就会弹出了一个下拉菜单中,进行下拉的菜单中进行选择local history的选项,然后再次选择下一级菜单中的show history。
相关推荐:
大家感兴趣的内容
12345678910
最近更新的内容君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
Android Studio使用指南v0.1
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口0 Estimated number of Applications downloaded in the Android Market
& History Clear Master 一键清除历史痕迹
571 sec ago
1728 sec ago
3005 sec ago
3530 sec ago
Rating4.17/5(64 Ratings)
Version2.3
Downloads10 000-50 000Estimate :12,075
Size399.9 KB
来电记录、浏览器浏览历史、搜索历史、Google地图搜索历史、Android Market搜索遗漏了很多的浏览记录,怎样才能方便地去除?清理大师能一键清除以上的历史记录,保护你的私隐和机器的干净。简单实用,一键清除,赶快来试试吧。Very easy to use and powerful tool for cleaning traces of history:It can clear -All the call(incoming,outgoing,missing) records,-Android market search history-Google Map search history,-Browsing search history-Gmail search history-more clear feature is coming soon.just by one key!KWHistoryEraser clear frequently contacted,auto clear phone,cache cleaner,clear cache,clear apps cache,history eraser,history cleaner,history erase,history clean,history clear,history clean up,call log clean,search history,clipboard data clean,历史记录清理,电话记录清理,删除短信,清除缓存,系统清理
iPhone related for History Clear Master 一键清除历史痕迹
History Clear Master 一键清除历史痕迹 was developed for Android by
Package name : com.droidware.android.clearmaster
System permissions :
Click here to show/hide list
android.permission.READ_CONTACTSandroid.permission.WRITE_CONTACTScom.android.browser.permission.WRITE_HISTORY_BOOKMARKScom.android.browser.permission.READ_HISTORY_BOOKMARKSandroid.permission.INTERNETandroid.permission.READ_PHONE_STATEandroid.permission.ACCESS_NETWORK_STATEandroid.permission.WRITE_EXTERNAL_STORAGE
No discussion found
Erase Apps Awesome High Five
gunnee WORKS GREAT!!!
Does nothing evo
Does what it days without gripes or complaints! Htc hero 2.1
Crap don't work Samsung Vibrant
No comment
Does nothing. Nothing!
Works great.I'm new to android and this app is really good
Super best
... you will most probably like those Android applications
US$2.00 Version 1.1.5
Addictive puzzle game. figure out a way to guide the block through obstacles and let it slide int... By
Available in :
Free Version 2.0.2
3d fantasy wallpapers... this app contains high quality images of 3d fantasy, fantasy art, fantas... By
Available in :
Free Version 4.1
Busybox installer is the most easy to use busybox installer on the market. it has more versions a... By
Available in :
Free Version 0.998
Keeps fertilized female mosquitoes (the ones that bite) away while playing ultrasound of a male m... By
Available in :
Free Version 1.27
Imeasy is a super cool im app that lets you chat with friends on aim msn yahoo facebook and googl... By
Available in :
History Clear Master 一键清除历史痕迹 for Android was rated by
Android Market Users on&&&&Android 搜索框历史记录
Android 搜索框历史记录
通过三个方法以及sharedpreferences实现android中常见的输入框的历史记录保存和展示:
performFiltering()匹配过滤搜索内容
initSearchHistory()读取历史搜索记录
saveSearchHistory()保存搜索记录
若举报审核通过,可奖励20下载分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
VIP下载&&免积分60元/年(1200次)
您可能还需要
移动开发下载排行}

我要回帖

更多关于 androidnohistory 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信