我做了一个git pull -rebase之后,我丢失了对文件所做的更改。我绝对不知道发生在这里的所有事情,但最后,我最终检查了我的更改(在一个单独的文件夹中备份它们)在提交之前粘贴回来。这是整个终端摊牌。
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git status
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Gemfile.lock
modified: app/controllers/application_controller.rb
modified: app/uploaders/pdf_uploader.rb
modified: lib/card/print_manager.rb
no changes added to commit (use "git add" and/or "git commit -a")
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git add -u
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git status
On branch card_application
Your branch is up-to-date with 'origin/card_application'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: Gemfile.lock
modified: app/controllers/application_controller.rb
modified: app/uploaders/pdf_uploader.rb
modified: lib/card/print_manager.rb
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git commit -m "Cleaning up temp pdf folder, reading directly from s3"
[card_application 04e9712] Cleaning up temp pdf folder, reading directly from s3
4 files changed, 53 insertions(+), 57 deletions(-)
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Username for 'https://github.com': userid@gmail.com
Password for 'https://**********:
To https://github.com/gitrepo/application.git
! [rejected] card_application -> card_application (fetch first)
error: failed to push some refs to 'https://github.com/gitrepo/application.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git pull --rebase
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 11 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (11/11), done.
From https://github.com/user2/application
458a7f6..c1021f4 card_application -> origin/card_application
First, rewinding head to replay your work on top of it...
Applying: Cleaning up temp pdf folder, reading directly from s3
Using index info to reconstruct a base tree...
M app/controllers/application_controller.rb
<stdin>:227: trailing whitespace.
#file =
<stdin>:246: trailing whitespace.
<stdin>:303: trailing whitespace.
warning: 3 lines add whitespace errors.
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
Gemfile.lock
Please, commit your changes or stash them before you can merge.
Aborting
Failed to merge in the changes.
Patch failed at 0001 Cleaning up temp pdf folder, reading directly from s3
The copy of the patch that failed is found in:
/mnt/c/Sites/application/.git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git checkout Gemfile.lock
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git rebase --continue
app/controllers/application_controller.rb: needs update
app/uploaders/pdf_uploader.rb: needs update
lib/card/print_manager.rb: needs update
You must edit all merge conflicts and then
mark them as resolved using git add
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git diff app/uploaders/pdf_uploader.rb
fatal: ambiguous argument 'app/uploaders/pdf_uploader.rb': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git status
rebase in progress; onto c1021f4
You are currently rebasing branch 'card_application' on 'c1021f4'.
(all conflicts fixed: run "git rebase --continue")
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: app/controllers/application_controller.rb
deleted: app/uploaders/pdf_uploader.rb
deleted: lib/card/print_manager.rb
no changes added to commit (use "git add" and/or "git commit -a")
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git rebase --continue
app/controllers/application_controller.rb: needs update
app/uploaders/pdf_uploader.rb: needs update
lib/card/print_manager.rb: needs update
You must edit all merge conflicts and then
mark them as resolved using git add
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git add app/uploaders/pdf_uploader.rb
warning: You ran 'git add' with neither '-A (--all)' or '--ignore-removal',
whose behaviour will change in Git 2.0 with respect to paths you removed.
Paths like 'app/uploaders/pdf_uploader.rb' that are
removed from your working tree are ignored with this version of Git.
* 'git add --ignore-removal <pathspec>', which is the current default,
ignores paths you removed from your working tree.
* 'git add --all <pathspec>' will let you also record the removals.
Run 'git status' to check the paths you removed from your working tree.
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git log
commit c1021f41cc7e01b3ee3c766698a3acbbd05824b3
Author: User1 <user1@gmail.com>
Date: Wed Aug 17 00:40:00 2016 -0400
Pre-filling instruction started
commit 458a7f6b353803453208da89c98e8f0e5f4dcf6e
Author: User2 <user2t@gmail.com>
Date: Tue Aug 16 22:48:55 2016 -0400
fixes continued
commit e92138bef7b6ad575cff7690621ab017cca4183f
Author: User3 <user3@gmail.com>
Date: Tue Aug 16 17:59:42 2016 -0400
Added tooltips to eligibility modal and attorney signup page. Added to Attorney Landing Page
commit 8d20bd7d29cdd42814e1872c4a70d453b14f8134
Author: User5 <user5@somedomain.com>
Date: Tue Aug 16 22:27:52 2016 +0530
Checked nil before destroying any record in card application
commit 688dd02069c9c7e35ea5bbc4f80f7860e95e9987
Author: User5 <user5@somedomain.com>
Date: Tue Aug 16 22:05:03 2016 +0530
Removed required validation for other names in applicant general tab. Also fixed the issue with applicant intending
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git cherry -v
Could not find a tracked remote branch, please specify <upstream> manually.
usage: git cherry [-v] [<upstream> [<head> [<limit>]]]
--abbrev[=<n>] use <n> digits to display SHA-1s
-v, --verbose be verbose
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git cherry -v origin/card_application
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git rebase --abort
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git cherry -v origin/card_application
+ 04e971223b5907305fbe95867a8db58e0de0ea4a Cleaning up temp pdf folder, reading directly from s3
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git diff-tree --no-commit-id --name-only -r 04e971223b5907305fbe95867a8db58e0de0ea4a
Gemfile.lock
app/controllers/application_controller.rb
app/uploaders/pdf_uploader.rb
lib/card/print_manager.rb
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git checkout 04e971223b5907305fbe95867a8db58e0de0ea4a Gemfile.lock
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git checkout 04e971223b5907305fbe95867a8db58e0de0ea4a app/controllers/application_controller.rb
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git checkout 04e971223b5907305fbe95867a8db58e0de0ea4a app/uploaders/pdf_uploader.rb
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git checkout 04e971223b5907305fbe95867a8db58e0de0ea4a lib/card/print_manager.rb
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git reset HEAD~
Unstaged changes after reset:
M Gemfile.lock
M app/controllers/application_controller.rb
M app/uploaders/pdf_uploader.rb
M lib/card/print_manager.rb
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git pull
Updating 458a7f6..c1021f4
error: Your local changes to the following files would be overwritten by merge:
app/controllers/application_controller.rb
Please, commit your changes or stash them before you can merge.
Aborting
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git stash "mychanges"
usage: git stash list [<options>]
or: git stash show [<stash>]
or: git stash drop [-q|--quiet] [<stash>]
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: git stash branch <branchname> [<stash>]
or: git stash [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [<message>]]
or: git stash clear
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git stash
Saved working directory and index state WIP on card_application: 458a7f6 fixes continued
HEAD is now at 458a7f6 fixes continued
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git pull
Updating 458a7f6..c1021f4
Fast-forward
app/controllers/application_controller.rb | 5 +++--
app/views/card_application/completion.en.html.haml | 21 ++++++++++++++-------
.../card_application/prefiling_instructions_concurrent/_passport_photos.en.html.haml | 8 +++++---
app/views/card_application/prefiling_instructions_concurrent/_us_status.en.haml | 6 ++++--
4 files changed, 26 insertions(+), 14 deletions(-)
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git unstash.pop
git: 'unstash.pop' is not a git command. See 'git --help'.
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git unstash
git: 'unstash' is not a git command. See 'git --help'.
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git stash apply
Auto-merging app/controllers/application_controller.rb
On branch card_application
Your branch is up-to-date with 'origin/card_application'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Gemfile.lock
modified: app/controllers/application_controller.rb
modified: app/uploaders/pdf_uploader.rb
modified: lib/card/print_manager.rb
no changes added to commit (use "git add" and/or "git commit -a")
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git add -u
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git status
On branch card_application
Your branch is up-to-date with 'origin/card_application'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: Gemfile.lock
modified: app/controllers/application_controller.rb
modified: app/uploaders/pdf_uploader.rb
modified: lib/card/print_manager.rb
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git commit -m "Cleaning up temp pdf folder , reading directly from s3"
[card_application 0379504] Cleaning up temp pdf folder , reading directly from s3
4 files changed, 53 insertions(+), 57 deletions(-)
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Username for 'https://github.com': rachit.pant@gmail.com
Password for 'https://afasdfasdf':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/gitrepo/application.git/'
thisuser@DESKTOP-ENS2652:/mnt/c/Sites/application$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Username for 'https://github.com': userid@gmail.com
Password for 'https://userid@gmail.com@github.com':
Counting objects: 51, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1.53 KiB | 0 bytes/s, done.
Total 11 (delta 9), reused 0 (delta 0)
remote: Resolving deltas: 100% (9/9), completed with 9 local objects.
To https://github.com/gitrepo/application.git
c1021f4..0379504 card_application -> card_application
答案 0 :(得分:0)
很难从你的300个左右的bash中得到错误(大概有90%是无用的)。但是我猜你在改造期间做错了什么。
对于每个步骤(每次提交你都在重新定位),如果存在冲突(似乎你有),你需要用编辑器或mergetool编辑冲突的文件(kdiff,meld,winmerge ,. ..)。解决冲突后(文件中不再有<<<...
,===...
或>>>...
),您需要添加文件(git add ...
)并继续使用您的rebase({{1}与你提交。
在开始使用rebase之前,请确保您的工作目录是干净的(通过存储,提交或取消您的本地更改)。
如果您不确定如果你是git的新手,那么如果你不确定如何使用它会导致它变得微不足道,那么to have a look at the doc就不会受到伤害。