reset

git reset(回退add操作)

佐手、 提交于 2019-12-26 01:27:49
在 Git 的一般使用中,如果发现错误的将不想提交的文件 add 进入 index 之后,想回退取消,则可以使用命令: git reset HEAD <file>... ,同时 git add 完毕之后, git 也会做相应的提示,比如: 引用 # Changes to be committed: # (use "git reset HEAD<file>..." to unstage) # # new file: Test. Scala git reset [ --hard|soft|mixed|merge|keep ] [<commit> 或 HEAD] :将当前的分支重设( reset )到指定的 <commit> 或者 HEAD (默认,如果不显示指定 commit ,默认是 HEAD ,即最新的一次提交),并且根据 [mode] 有可能更新 index 和 working directory 。 下面列出一些 git reset 的典型的应用场景: A) 回滚 add 操纵 引用 $ edit (1) $ git add frotz.c filfre.c $ mailx (2) $ git reset (3) $ git pull git://info.example.com/ nitfol (4) (1) 编辑文件 frotz.c, filfre.c ,做了些更改

git回滚命令reset、revert的区别

微笑、不失礼 提交于 2019-12-26 01:26:41
##使用git,总有一天会遇到下面的问题: (1)改完代码匆忙提交,上线发现有问题,怎么办? 赶紧回滚。 (2)改完代码测试也没有问题,但是上线发现你的修改影响了之前运行正常的代码报错,必须回滚。 所以git的取消提交、回退甚至返回上一版本是比较重要的。 大致分为下面2种情况: 1、没有push 这种情况发生在你的本地代码仓库,可能你add、commit以后发现代码有点问题,准备取消提交,用reset git reset \--soft | --mixed | --hard 参数说明: --soft:保留源码,只回退commit信息到某个版本,不涉及index的回退。如果还需要提交,直接commit即可。 --mixed:会保留源码,只是将git commit和index的信息回退到了某个版本。(git reset默认的就是--mixed模式,即git reset等价于git reset --mixed) --hard:源码也会回退到某个版本,commit和index都会回退到某个版本。(注意这种方式是会改变本地代码仓库源码)   当然有人在push代码以后,也使用 reset --hard 回退代码到某个版本之前。但是这样会有一个问题,你线上的代码没有变,线上commit、index都没有变,当你把本地代码修改完提交的时候你会发现全是冲突........所以

Git Reset 三种模式hard,soft,mix

梦想与她 提交于 2019-12-25 17:14:45
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 有时候,我们用Git的时候有可能commit提交代码后,发现这一次commit的内容是有错误的,那么有两种处理方法: 1、修改错误内容,再次commit一次 2、使用 git reset 命令撤销这一次错误的commit 第一种方法比较直接,但会多次一次commit记录。 而我个人更倾向第二种方法,错误的commit没必要保留下来。 那么今天来说一下 git reset 。它的一句话概括 git-reset - Reset current HEAD to the specified state 意思就是可以让HEAD这个指针指向其他的地方。例如我们有一次commit不是不是很满意,需要回到上一次的Commit里面。那么这个时候就需要通过reset,把HEAD指针指向上一次的commit的点。 它有三种模式,soft,mixed,hard,具体的使用方法下面这张图,展示的很全面了。 git各个区域和命令关系 这三个模式理解了,对于使用这个命令很有帮助。在理解这三个模式之前,需要略微知道一点Git的基本流程。正如上图,Git会有三个区域: Working Tree 当前的工作区域 Index/Stage 暂存区域,和git stash命令暂存的地方不一样。使用git add xx,就可以将xx添加近Stage里面

Unable to clear text field with overridden submit method used for ajax implementation via Jquery 1.4

醉酒当歌 提交于 2019-12-25 04:45:32
问题 I have a functionality of posting messages to a group which works using AJAX via Jquery. When I click on the "Post" button which is the value of the submit_tag, javascript is rendered and the page without reloading displays the latest message posted. Basically the post_message.js.erb file is called. I am making use of the following tutorial to implement the same:- http://railscasts.com/episodes/136-jquery The code for post_message.js.erb looks like this:- $("#new_post").before('<div id ="new

Reset radioButtons in shiny to empty value

血红的双手。 提交于 2019-12-25 00:59:22
问题 Is it possible in shiny to reset radioButtons to an empty value (i.e. as if the radiobuttons would not have been clicked and the default value was empty (selected = ""))? I tried reset("btn") with shinyjs() and updateRadioButtons(session, "btn",...). However, I only managed to reset the radiobuttons to a specific value (e.g. the first value in the list or another predefined value), but not to an empty value. The reset to an empty value would make it possible to use a single set of

git 知识点

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 17:57:57
git 删除远程已经推送过的文件或者文件夹 git rm -r --cached [文件或文件夹] git status git add . git commit -m '删除远程仓库文件,本地仓库和暂存区不受影响' git push 问:如何上传项目代码到gitlab? 答: git remote add 把文件commit到master 在gitlab上创建dev分支 pull后,切换到dev分支 把master的内容merge到dev。 想把某些目录或文件加入忽略规则,.gitignore只能忽略那些原来没有被track的文件,如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的。 那么解决方法就是先把本地缓存删除(改变成未track状态),然后再提交:(后面的点号根据情况可以是文件或文件夹) git rm -r --cached . git add . git commit -m 'update .gitignore' vue项目修改了代码, 必须打包。 mac下git安装: brew install git 运行brew命令,需要先安装 homebrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

AOG implicit account linking - How to reset?

蹲街弑〆低调 提交于 2019-12-24 17:02:22
问题 I have setup an implicit account linking page. I tested it with AOG - all good, surface checked, user sent over to the phone app if needed, link worked (status OK, accessToken present). Now I can't figure out how to reset the user id or the account linking status to repeat this. It's not just testing. The user could need a new token for many other reasons. Currently if I initiate a subsequent SING_IN it comes back immediately with an OK and the accessToken. 回答1: If you are using the Implict

Reset a form, without javascript? (input type=reset not working)

可紊 提交于 2019-12-24 06:01:10
问题 Well, I guess the title says it all. I'm looking for a way to reset all the fields within a form. I've tried some of the following: <input type="reset" value="Clear all fields"> And <button type="reset">Clear all fields</button> Yet, none of this seems to be working. This is a stripped version of my form. <form id="form2" action="mainframe.php?paso=21" method="POST"> <input type="reset" value="Reset"> <button type="reset" form="form2">Reset</button> <?php while($row=$resultado->fetch_assoc())

Jquery Radio Button uncheck radio button, but should not clear value part

守給你的承諾、 提交于 2019-12-24 03:44:06
问题 I am trying to clear my form fields on reset button using following code $(':input',formId).not(':button, :submit, :reset, :hidden').val('').prop('checked', false).removeAttr('selected'); Now my Radio button is getting unchecked, but value set in radio button is also getting cleared. I want only to uncheck it, But value of the radio button should be available. 回答1: You can use reset() function here: formId.reset(); reset resets the form to its initial state. FIDDLE DEMO 回答2: don't clear the

Remove stale commits from Git

若如初见. 提交于 2019-12-24 02:48:09
问题 I have made some test commits (to test a commit hook) and always reset the index to my last normal commit. Now these stale commits still exist: > git reflog fcdabf7 HEAD@{0}: reset: moving to fcdabf7e01845d6f000fc3cef2edc999c57a7e29 5c97564 HEAD@{1}: commit: t fcdabf7 HEAD@{2}: reset: moving to fcdabf7e01845d6f000fc3cef2edc999c57a7e29 ae52246 HEAD@{3}: commit: t fcdabf7 HEAD@{4}: reset: moving to fcdabf7e01845d6f000fc3cef2edc999c57a7e29 c58aeef HEAD@{5}: commit: t fcdabf7 HEAD@{6}: reset: