小编rah*_*hul的帖子

git filter-branch拒绝后git push

我将一个git repo分成3个.我使用Detach(move)子目录到单独的Git存储库中来分隔文件夹并将它们成功推送到新的git repos.在现有的 repo上,我使用了以下命令来清除移动的目录.

git filter-branch -f --index-filter "git rm -q -r -f --cached --ignore-unmatch lib/xxx/$REPO" --prune-empty HEAD
Run Code Online (Sandbox Code Playgroud)

现在当我做git st原始回购时,我得到:

# On branch 1.5.0
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)

当我尝试时git push,我得到:

 ! [rejected]        1.5.0 -> 1.5.0 (non-fast-forward)
error: failed to push some refs to 'git@github.com:/xxx/.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of …
Run Code Online (Sandbox Code Playgroud)

git git-filter-branch

12
推荐指数
1
解决办法
7407
查看次数

ruby:can模块可以自动执行初始化代码吗?

我在一个模块中放了一些功能,由一个对象扩展.我想在扩展模块时自动执行功能.但是,它必须在实例的上下文中执行,而不是在Module中执行.

module X
   extend self

   @array = [1,2,3]

end
obj.extend(X)
Run Code Online (Sandbox Code Playgroud)

目前,@ array未在实例中创建.我不希望强制开发人员调用一些初始化方法,因为对于每个模块,他需要知道要调用的唯一方法的名称.这可能吗 ?

ruby

7
推荐指数
1
解决办法
3023
查看次数

bash:刷新标准输入(标准输入)

我有一个bash脚本,我主要在交互模式下使用.但是,有时我会在脚本中输入一些输入.在循环中处理stdin之后,我使用"-i"(交互式)复制文件.但是,这永远不会被执行(在管道模式下),因为(我猜)标准输入还没有被刷新.为简化示例:

#!/bin/bash
while read line
do
    echo $line
done
# the next line does not execute 
cp -i afile bfile
Run Code Online (Sandbox Code Playgroud)

将其放在t.sh中,并执行:ls | ./t.sh

不执行读取.我需要在读取之前刷新stdin.怎么会这样呢?

bash stdin flush

4
推荐指数
1
解决办法
4644
查看次数

Symbol的函数定义是void:declare-function

emacs新手.OSX上的GNU Emacs 22.1.1.根据指示安装邪恶.我明白了:

Symbol's function definition is void: declare-function

emacs --debug-init gives:

Debugger entered--Lisp error: (void-function declare-function)  
  (declare-function evil-visual-state-p "evil-visual")  
  eval-buffer(#<buffer  *load*<3>> nil "/Users/rahul/.emacs.d  /evil/evil-repeat.el" nil t)  ; Reading at buffer pos$  
  load-with-code-conversion("/Users/rahul/.emacs.d/evil/evil-  repeat.el" "/Users/rahul/.emacs.d/evil/evil-repeat.el$  
  require(evil-repeat)  
  eval-buffer(#<buffer  *load*<2>> nil "/Users/rahul/.emacs.d  /evil/evil.el" nil t)  ; Reading at buffer position 1$  
  load-with-code-conversion("/Users/rahul/.emacs.d/evil/evil.el"   "/Users/rahul/.emacs.d/evil/evil.el" nil t)  
  require(evil)  
  eval-buffer(#<buffer  *load*> nil "/Users/rahul/.emacs" nil t)    ; Reading at buffer position 122  
  load-with-code-conversion("/Users/rahul/.emacs"   
"/Users/rahul/.emacs" t t)  
  load("~/.emacs" t t)  
  #[nil "^H\205\276^@   \306=\203^Q^@\307^H\310Q\202A^@ \311=\2033^@\312\307\313\314#\203#^@\315\202A^@\312\307\31$
  command-line()
  normal-top-level()
Run Code Online (Sandbox Code Playgroud)

我的.emacs有: …

emacs evil-mode

3
推荐指数
1
解决办法
3922
查看次数

标签 统计

bash ×1

emacs ×1

evil-mode ×1

flush ×1

git ×1

git-filter-branch ×1

ruby ×1

stdin ×1