完成功能分支后,git rebase -i
我意外删除了所有提交.我不完全确定,但我怀疑不是压缩我的提交,而是用提交消息替换整个条目.
http://shafiulazam.com/gitbook/4_interactive_rebasing.html说:
交互式rebase可以做的最后一个有用的事情就是为你删除提交.如果不是为提交行选择"选择","压缩"或"编辑",只需删除该行,它将从历史记录中删除提交.
我的问题是:有没有办法恢复/撤消这个?
我正在升级具有大量SCSS样式表的rails应用程序以使用资产管道,并且需要为每个文件包含一些全局变量和mixin.
@import
在每个文件的顶部添加几个指令不是很干,所以我想做这样的事情:
# application.css
/*
*= require variables
*= require mixins
*= require_tree .
*/
Run Code Online (Sandbox Code Playgroud)
当然,这不起作用,因为变量不会跨文件持久存在.谁知道如何实现这一目标?
我在我的项目中引用了一个git子模块,现在需要在目标git repo中引用一个特定的SHA.
# .gitmodules
[submodule "vendor/plugins/ssl_requirement"]
path = vendor/plugins/ssl_requirement
url = git://github.com/retr0h/ssl_requirement.git
Run Code Online (Sandbox Code Playgroud)
我想要的SHA是bc96ad96407a72a60e0542cf3b0cecc6ff9e278e
.
我使用rails.vim但想使用ultisnips覆盖我自己的一两个片段.
我已经创建了片段,但由于它们已经由rails.vim定义,因此触发时会出现一个菜单.我希望我的代码段覆盖现有代码以避免菜单.
在我的rails 3.1.3应用程序中,我想在我的javascript文件中插入一些ERB代码但是由于某种原因它没有被解析:
# app/assets/javascripts/application.js
//= require_tree ./shared
# app/assets/javascripts/shared/shared.js.erb
MM.loading = '<img src="<%= asset_path("icons/ajax-loader.gif") >">';
Run Code Online (Sandbox Code Playgroud)
获取如下所示/application.js
:
MM.loading = '<img src=" asset_path("icons/ajax-loader.gif") >">';
Run Code Online (Sandbox Code Playgroud)
我在导轨指南中看不到任何额外的步骤 - 有什么我想念的吗?顺便说一下,我正在使用haml作为视图文件,并且还尝试了上面的内容.js.haml
,包含在中#{...}
.
是否有推荐的技术将大量回形针S3图像迁移到新的:url和:路径格式?
原因是因为在升级到rails 3.1之后,裁剪后没有显示新版本的拇指(显示以前缓存的版本).这是因为文件名不再更改(因为在rails 3.1中删除了asset_timestamp).我正在使用:url/path格式的指纹,但这是从原始生成的,在裁剪时不会改变.
我打算在url/path格式中插入:updated_at,并在裁剪期间更新attachment.updated_at,但在实现该更改后,所有现有图像都需要移动到新位置.大约有50万张图像要重命名为S3.
此时我正在考虑首先将它们复制到新位置,然后部署代码更改,然后移动任何错过的图像(即复制后上传),但我希望有更简单的方法...任何建议?
我无法使用shopify_api gem访问Shopify API.
这是发生的事情:
>> require "shopify_api" #=> false
>> ShopifyAPI::Base.site = "https://username:secret@mysite.myshopify.com/admin"
=> "https://username:secret@mysite.myshopify.com/admin"
>> products = ShopifyAPI::Product.find(:all)
Errno::ECONNRESET: Connection reset by peer - SSL_connect
from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `connect'
from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `connect'
from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:744:in `start'
from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1026:in `get'
from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/connection.rb:113:in `block in request'
from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument'
from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument'
from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/connection.rb:110:in `request'
from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/shopify_api-3.0.1/lib/active_resource/connection_ext.rb:13:in `request_with_detailed_log_subscriber'
from /Users/zubin/.rvm/gems/ruby-1.9.3-p194/gems/activeresource-3.2.8/lib/active_resource/connection.rb:80:in `block …
Run Code Online (Sandbox Code Playgroud) 根据指南:
...在扩展名为.builder,.rb,.erb,.haml和.slim的文件中完成,用于默认和自定义注释.
但即使手动配置,它也无法正常工作:
$ rails -v
Rails 4.2.3
$ grep -r annotations config/environments/development.rb
config/environments/development.rb: config.annotations.register_extensions('haml') { |a| /#\s*(#{a}):?\s*(.*)$/ }
$ grep -r TODO app/views
app/views/orders/show.html.haml: -# TODO: Add link
$ rake notes
app/models/order.rb:
* [12] [TODO] Refactor
Run Code Online (Sandbox Code Playgroud)
有谁知道如何让它工作?
Using Plug.Test.conn
, setting the request body doesn't seem to work.
Here's the plug:
defmodule MyPlug do
import Plug.Conn
def init(_), do: nil
def call(conn, _) do
{:ok, body, _conn} = read_body(conn)
send_resp(conn, 200, "body: #{body}")
end
end
Run Code Online (Sandbox Code Playgroud)
Using curl
:
$ curl -X POST -d foo=bar http://localhost:4000/
body: foo=bar
Run Code Online (Sandbox Code Playgroud)
Using Plug.Test
:
defmodule MyTest do
use ExUnit.Case, async: false
use Plug.Test
test "POST request" do
conn = conn(:post, "/", %{foo: "bar"})
|> MyPlug.call(%{})
assert conn.resp_body == "body: foo=bar"
end …
Run Code Online (Sandbox Code Playgroud) 不知道我是如何管理这个的,但我不能再创建本地和远程分支了。
~/myapp(master) > git checkout -b new_feature origin/new_feature
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'origin/new_feature' which can not be resolved as commit?
Run Code Online (Sandbox Code Playgroud)
我试过重新克隆我的应用程序,以防 .git 目录损坏,但没有运气。有什么建议?