2008-11-28 4 views
5

समस्या:Git संकट:, खिड़कियों पर संपादित अब w/लिनक्स पर समस्याओं

edited files on windows, using git-bash, to fix IE7 problems 

committed, pushed to github repo 

booted back into linux 

pulled from repo 

merge conflict in dozens of files 

used 'git reset --hard' 

क्या मैं ट्रैक पर वापस पाने के लिए कर सकते हैं?

अद्यतन: कृपया स्पष्ट चित्र के लिए निम्नलिखित (कोई विडंबना इरादा)

(मुझे लगता है कि समस्या एक है कि मैं अक्सर सामना करते हैं, कि स्फिंक्स फ़ाइलों मंच पर निर्भर हैं, और मैं नहीं देखो पता उन्हें पुल में छोड़ करने के लिए कैसे।)

[email protected]:~$ cd Rails/nutrograph/ 
[email protected]:~/Rails/nutrograph$ git rm nutrograph/ 
fatal: pathspec 'nutrograph/' did not match any files 
[email protected]:~/Rails/nutrograph$ git pull 
remote: Counting objects: 29, done. 
remote: Compressing objects: 100% (13/13), done. 
remote: Total 15 (delta 11), reused 0 (delta 0) 
Unpacking objects: 100% (15/15), done. 
From [email protected]:shalunov/nutrograph 
    1925d73..1ed7f46 master  -> origin/master 
Updating 1925d73..1ed7f46 
TODO: needs update 
app/models/data_link.rb: needs update 
app/models/footnote.rb: needs update 
app/models/static_chart.rb: needs update 
app/views/food_description/index.haml: needs update 
app/views/food_description/titles.haml: needs update 
app/views/site/about.html.erb: needs update 
app/views/static_page/_random_foods.haml: needs update 
app/views/static_page/index.haml: needs update 
app/views/static_page/show.haml: needs update 
app/views/static_page/sweet-potato-cooked-boiled-without-skin: needs update 
config/development.sphinx.conf: needs update 
config/environment.rb: needs update 
db/migrate/10_create_food_comparisons.rb: needs update 
db/sphinx/development/food_description_core.spa: needs update 
db/sphinx/development/food_description_core.sph: needs update 
db/sphinx/development/food_description_core.spl: needs update 
public/static_pages/beans-snap-green-cooked-boiled-drained-with-salt: needs update 
public/static_pages/butter-salted: needs update 
public/static_pages/cheese-muenster: needs update 
public/static_pages/sweet-potato-cooked-boiled-without-skin: needs update 
test/fixtures/data_links.yml: needs update 
test/fixtures/footnotes.yml: needs update 
test/fixtures/static_charts.yml: needs update 
test/unit/static_chart_test.rb: needs update 
vendor/plugins/haml/init.rb: needs update 
error: Entry 'app/views/static_page/index.haml' not uptodate. Cannot merge. 
[email protected]:~/Rails/nutrograph$ l 
app/  CSV_files/ doc/ log/   public/ README.rdoc spec/  test/ TODO    vendor/ 
config/ db/   lib/ Nutrograph.pdf Rakefile script/  stories/ tmp/ utf8_general_ci 
[email protected]:~/Rails/nutrograph$ mkdir backup 
[email protected]:~/Rails/nutrograph$ cd backup/ 
[email protected]:~/Rails/nutrograph/backup$ git clone [email protected]:shalunov/nutrograph.git 
Initialized empty Git repository in /home/jess/Rails/nutrograph/backup/nutrograph/.git/ 
remote: Counting objects: 2346, done. 
remote: Compressing objects: 100% (2025/2025), done. 
remote: Total 2346 (delta 958), reused 996 (delta 146) 
Receiving objects: 100% (2346/2346), 19.74 MiB | 373 KiB/s, done. 
Resolving deltas: 100% (958/958), done. 
Checking out files: 100% (867/867), done. 
[email protected]:~/Rails/nutrograph/backup$ script/server 
bash: script/server: No such file or directory 
[email protected]:~/Rails/nutrograph/backup$ cd nutrograph/ 
[email protected]:~/Rails/nutrograph/backup/nutrograph$ script/server 
=> Booting Mongrel (use 'script/server webrick' to force WEBrick) 
=> Rails 2.1.2 application starting on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
/usr/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/servers/mongrel.rb:57:in `initialize': No such file or directory - /home/jess/Rails/nutrograph/backup/nutrograph/log/development.log (Errno::ENOENT) 
    from /usr/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/servers/mongrel.rb:57:in `open' 
    from /usr/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/servers/mongrel.rb:57 
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in `require' 
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:355:in `new_constants_in' 
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in `require' 
    from /usr/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/server.rb:39 
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from script/server:3 
[email protected]:~/Rails/nutrograph/backup/nutrograph$ git merge 
usage: git-merge [options] <remote>... 
    or: git-merge [options] <msg> HEAD <remote> 

    --stat    show a diffstat at the end of the merge 
    -n     don't show a diffstat at the end of the merge 
    --summary    (synonym to --stat) 
    --log     add list of one-line log to merge commit message 
    --squash    create a single commit instead of doing a merge 
    --commit    perform a commit if the merge succeeds (default) 
    --ff     allow fast forward (default) 
    -s, --strategy ... merge strategy to use 
    -m, --message ...  message to be used for the merge commit (if any) 

[email protected]:~/Rails/nutrograph/backup/nutrograph$ git merge origin/master 
Already up-to-date. 
[email protected]:~/Rails/nutrograph/backup/nutrograph$ git pull 
Already up-to-date. 
[email protected]:~/Rails/nutrograph/backup/nutrograph$ cd ../.. 
[email protected]:~/.local/share/Trash/files$ cd 
[email protected]:~$ cd Rails/nutrograph/ 
[email protected]:~/Rails/nutrograph$ git merge 
usage: git-merge [options] <remote>... 
    or: git-merge [options] <msg> HEAD <remote> 

    --stat    show a diffstat at the end of the merge 
    -n     don't show a diffstat at the end of the merge 
    --summary    (synonym to --stat) 
    --log     add list of one-line log to merge commit message 
    --squash    create a single commit instead of doing a merge 
    --commit    perform a commit if the merge succeeds (default) 
    --ff     allow fast forward (default) 
    -s, --strategy ... merge strategy to use 
    -m, --message ...  message to be used for the merge commit (if any) 

[email protected]:~/Rails/nutrograph$ git merge orgin 
orgin - not something we can merge 
[email protected]:~/Rails/nutrograph$ git merge orgin/master 
orgin/master - not something we can merge 
[email protected]:~/Rails/nutrograph$ git rebase orgin/master 
TODO: needs update 
app/views/static_page/index.haml: needs update 
config/development.sphinx.conf: needs update 
config/environment.rb: needs update 
db/sphinx/development/food_description_core.spa: needs update 
db/sphinx/development/food_description_core.sph: needs update 
vendor/plugins/haml/init.rb: needs update 
[email protected]:~/Rails/nutrograph$ git reset --hard 
HEAD is now at 1925d73 got rid of "Nutrition Facts" in view 
[email protected]:~/Rails/nutrograph$ git pull 
Updating 1925d73..1ed7f46 
Fast forward 
app/views/layouts/application.haml | 25 +++++++++++-------------- 
app/views/static_page/index.haml | 6 +++--- 
nutrograph       | 1 + 
public/javascripts/tabs.js   | 4 +++- 
public/stylesheets/sass/site.sass | 16 +++++++++------- 
public/stylesheets/site.css  | 14 ++++++++------ 
6 files changed, 35 insertions(+), 31 deletions(-) 
create mode 160000 nutrograph 
[email protected]:~/Rails/nutrograph$ script/server 
=> Booting Mongrel (use 'script/server webrick' to force WEBrick) 
=> Rails 2.1.2 application starting on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
** Starting Mongrel listening at 0.0.0.0:3000 
** Starting Rails with development environment... 
** Rails loaded. 
** Loading any Rails specific GemPlugins 
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). 
** Rails signals registered. HUP => reload (without restart). It might not work well. 
** Mongrel 1.1.5 available at 0.0.0.0:3000 
** Use CTRL-C to stop. 


Processing SiteController#index (for 127.0.0.1 at 2008-11-28 16:45:38) [GET] 
    Session ID: aa0ab6213969dc2ce78472f9c5f57258 
    Parameters: {"action"=>"index", "controller"=>"site"} 
    SQL (0.000153) SET NAMES 'utf8' 
    SQL (0.000077) SET SQL_AUTO_IS_NULL=0 
    StaticPage Columns (0.000841) SHOW FIELDS FROM `static_pages` 
. 
. 
. 
. 
Rendering template within layouts/application 
Rendering static_page/index 
Completed in 0.69965 (1 reqs/sec) | Rendering: 0.34820 (49%) | DB: 0.26384 (37%) | 200 OK [http://localhost/4000-beef-round-top-round-separable-lean-only-trimmed-to-quarter-inch-fat-select-cooked-braised] 
^C** INT signal received. 
Exiting 
[email protected]:~/Rails/nutrograph$ git pull 
Already up-to-date. 
[email protected]:~/Rails/nutrograph$ git rebase origin/master 
vendor/plugins/haml/init.rb: needs update 
[email protected]:~/Rails/nutrograph$ git pull 
Already up-to-date. 
[email protected]:~/Rails/nutrograph$ git pull origin/master 
fatal: 'origin/master': unable to chdir or not a git archive 
fatal: The remote end hung up unexpectedly 
[email protected]:~/Rails/nutrograph$ git rebase origin/master 
vendor/plugins/haml/init.rb: needs update 
[email protected]:~/Rails/nutrograph$ rm vendor/plugins/haml/init.rb 
[email protected]:~/Rails/nutrograph$ rm vendor/plugins/haml/init.rb 
rm: cannot remove `vendor/plugins/haml/init.rb': No such file or directory 
[email protected]:~/Rails/nutrograph$ haml --rails . 
Directory ./vendor/plugins/haml already exists, overwrite [y/N]? y 
Haml plugin added to . 
[email protected]:~/Rails/nutrograph$ git rebase origin/master 
vendor/plugins/haml/init.rb: needs update 
[email protected]:~/Rails/nutrograph$ git fetch origin 
[email protected]:~/Rails/nutrograph$ git merge origin/master 
Already up-to-date. 
[email protected]:~/Rails/nutrograph$ git rebase origin/master 
vendor/plugins/haml/init.rb: needs update 
[email protected]:~/Rails/nutrograph$ git pull 
Already up-to-date. 
[email protected]:~/Rails/nutrograph$ 

यह वास्तव में एक लाइन फ़ीड समस्या नहीं है, जैसा कि मैंने यूनिक्स शैली लाइन अंत का उपयोग करने के लिए ई पाठ संपादक निर्धारित किया है। इस बिंदु पर, मुझे नहीं पता कि समस्या क्या है, बस मुझे एक बदलाव की जरूरत है।

क्या आप अनदेखा कर रहे हैं कि मैंने 'गिट रीसेट - हार्ड' चलाया ??

उत्तर

10

ऐसा लगता है कि आप की तरह लाइन Windows में विकल्प न खत्म होने वाली निर्धारित करने की आवश्यकता:

git config core.autocrlf true 

यह git add पर फिर से वापस विंडोज पर CRLF के लिए वामो से लाइन अंत बदलने और होगा। इसके बिना, गिट सोचता है कि आपने एलएफ से सीआरएलएफ तक पूरी फाइल की लाइनिंग को बदल दिया है, जो विलय विवादों का कारण बन सकता है।

इसके अलावा, आपका विवरण लगता है जैसे आप एक दोहरी बूट स्थिति में विंडोज और लिनक्स के बीच एक ही कामकाजी भंडार साझा करने की कोशिश कर रहे हैं। मैं उपर्युक्त कारण के लिए इसकी सिफारिश नहीं करता। प्रत्येक ओएस के लिए अलग भंडार का प्रयोग करें।

1

मुझे यकीन नहीं है कि आपने यह संपूर्ण प्रतिलेख क्यों पोस्ट किया है, यह दिखाता है कि आपको केवल लाइन समाप्त करने वाली समस्याएं नहीं हैं। शायद आप मानते हैं कि आपके पास कई समस्याओं का एक कारण था।

मुझे लगता है कि आपने अपने लिनक्स सिस्टम पर यह रेपो बनाया है, फिर इसे गिटहब पर अपलोड किया है, फिर अपने विंडोज सिस्टम पर क्लोन किया गया है। जब आप एक रेपो क्लोन करते हैं, तो गिट कुछ कॉन्फ़िगरेशन पैरामीटर सेट करता है ताकि यह पता चल सके कि git pull बाद में कैसे करें, लेकिन जब आप रिमोट रिपोजिटरी बनाते हैं, तो आपको उन्हें मैन्युअल रूप से सेट करना होगा। (। यही कारण है कि स्पष्ट रूप से कहीं भी दस्तावेज नहीं है कि मैंने देखा है)

GitHub रेपो बनाने के बाद, आप अपने Linux सिस्टम पर सेट किया जा सकता था:

$ git config branch.master.remote origin 
$ git config branch.master.merge refs/heads/master 

ये कॉन्फ़िगर Git ताकि भविष्य Git पुल के इस रेपो से होगा स्वचालित रूप से सभी रिमोट परिवर्तन मर्ज करें। इन जगहों पर आपके pull काम करेंगे।

एक उपनिर्देशिका में रिमोट रिपोजिटरी को क्लोन करने से यह बहुत अच्छी तरह से हल हो गया है, क्योंकि क्लोनिंग ने कॉन्फ़िगरेशन सेट किए हैं ताकि खींचने से आपके लिनक्स सिस्टम से काम किया जा सके। मिस्पालिंग 'उत्पत्ति' के रूप में 'ऑर्गिन' इस तथ्य को ढंक सकता है कि आपकी खींच काम करेगी।

यदि यह आपको समझ में आता है, तो मेरा सुझाव है कि आप रेल को शुरू करने के लिए ट्रांसक्रिप्ट को हटा दें ताकि आपके पास दूसरी समस्या पर ध्यान केंद्रित करना आसान हो सके।