Monday, 15 April 2013

Git interactive rebase without opening the editor -


For example:

The guit allows certain commands to be created or modified without opening an editor, for example:

  git commit --amend --no-edit git commit --fixup = HEAD ^  

I rebase.autosquash To true , so that the customized list automatically re-ordered for an interactive rebase.

  git rebase -i - no-edit HEAD ~ 3  

  without opening the editor, / div> 

TL; DR Answer: GIT_SEQUENCE_EDITOR =: git rebase -i HEAD ~ 3

You are the "Sequence Editor" (this is an edit command on "Sequence File", in which different pickups, commands) Can not stop git rebase - interactive from running. However, if you check the interactive rebace script:

  $ vim $ (git --exec-path) / git-rebase - interactive  

You will get around 230 lines or a code:

  git_sequence_editor () {If the test -z "$ GIT_SEQUENCE_EDITOR" then GIT_SEQUENCE_EDITOR = "$ (git config sequence.editor)" if [- Z "$ GIT_SEQUENCE_EDITOR"] GIT_SEQUENCE_EDITOR = "$ (git var GIT_EDITOR)" || $ Refund? "$ GIT_SEQUENCE_EDITOR" '' $ $ '' '}  

In this way, you just need to set the sequence editor of an "edit" command which does nothing and then Succeeds, such as the shell's underlying : command, or true command.

(Anyone of <$> GIT_SEQUENCE_EDITOR , configured sequence editor , or $ GIT_EDITOR is enough for this However, the best to use is the first.)


No comments:

Post a Comment