git-revert

Why is git revert telling me “bad revision” when I use a commit hash?

巧了我就是萌 提交于 2020-01-01 10:09:56
问题 I am trying to revert to an earlier git commit but get the error "bad revision". Why? Here is a transcript (with author names removed): Ellen@ELLEN-PC /c/Users/Susan Mills/git/hello-github (master) $ git status # On branch master nothing to commit, working directory clean Ellen@ELLEN-PC /c/Users/Susan Mills/git/hello-github (master) $ git log | head commit e3eb30cc7ca6d4cd10de755b63821cad75da1e83 Date: Wed Feb 5 17:54:32 2014 -0800 I changed my greeting. commit

Visual Studio 2015 Git error message “Cannot pull/switch because there are uncommitted changes”

我是研究僧i 提交于 2019-12-31 08:34:21
问题 I am having difficulty in doing a pull from origin . I keep getting: "Cannot pull because there are uncommitted changes. Commit or undo your changes before pulling again. See the Output window for details." This also applies to switching branches. I get a similar sort of message, but this does not always happen. I am using Visual Studio 2015 Update 1 and Visual Studio Team Services Git. On my machine I have a local master branch, and development branches. Every time I switch to master and

Visual Studio 2015 Git error message “Cannot pull/switch because there are uncommitted changes”

好久不见. 提交于 2019-12-31 08:34:06
问题 I am having difficulty in doing a pull from origin . I keep getting: "Cannot pull because there are uncommitted changes. Commit or undo your changes before pulling again. See the Output window for details." This also applies to switching branches. I get a similar sort of message, but this does not always happen. I am using Visual Studio 2015 Update 1 and Visual Studio Team Services Git. On my machine I have a local master branch, and development branches. Every time I switch to master and

Which commit hash to undo a pushed merge using git-revert?

拈花ヽ惹草 提交于 2019-12-23 08:45:48
问题 I merged the beta branch into the master branch. I pushed to origin. I now want master to be as it was prior to the merger both locally and remotely. A good answer for undoing a merge that was already pushed suggests git revert -m 1 commit_hash If this is indeed the way to go, how can I determine commit_hash ? I unsuccessfully tried the hash returned by merge-base: $ git merge-base --all master beta 1f4b949b7ef97abf913ae672e3acd0907abfac1b $ git revert -m 1

Revert all commits by a specific author since specific time

假装没事ソ 提交于 2019-12-21 04:23:22
问题 I want to revert all commits by a specific author since 4 days ago. How do I do it? To get all sha1s (with a bit of noise) I can use this: git log --author=Mohsen --pretty=one --since=4.days 回答1: You have to give format:%H to git log and use a loop: for sha in `git log --pretty=format:%H --author=Mohsen --since=4.days`; do git revert --no-edit $sha done This will create one commit per revert. Suppress the --no-edit option to modify interactively the commit message on each revert. Or, if you

Git Revert a Revert for a Merge

99封情书 提交于 2019-12-21 04:15:13
问题 I had a feature branch created, let's say feature/branch1 on github. I created a pull request for it and got it merged. When it reached our pipeline, we figured there was a problem and we got it reverted using the Revert button on Git This created a "Revert" PR that we merged with the master and all was well. After a few weeks, post other PRs that got merged into the master, we figured we would revert-the-revert . This time, we went into the Revert PR that was closed and tried to use the

Git revert certain files

冷暖自知 提交于 2019-12-18 14:15:24
问题 I want to do a revert of a commit, but only for some files. ( Not a checkout; a revert. If you are unfamiliar with the difference, keep reading.) I tried this git revert --no-commit abcdef123456 -- my/path/to/revert And I got this error fatal: ambiguous argument 'my/path/to/revert': unknown revision or path not in the working tree. Use '--' to separate paths from revisions But that is precisely what I did! (And yes, my/path/to/revert is in my working tree.) My working theory is that it is not

Reverting specific commits from git

ⅰ亾dé卋堺 提交于 2019-12-18 10:17:05
问题 I have a git tree with a lot of commits and a lot of files. Now, I want to revert specific commits that touch a file only. To explain: > git init Initialized empty Git repository in /home/psankar/specific/.git/ > echo "File a" > a > git add a ; git commit -m "File a" [master (root-commit) 5267c21] File a 1 file changed, 1 insertion(+) create mode 100644 a > echo "File b" > b > git add b; git commit -m "File b" [master 7b560ae] File b 1 file changed, 1 insertion(+) create mode 100644 b > echo

Easiest way to bring back a previous commit point to the top in Git

泄露秘密 提交于 2019-12-18 09:47:28
问题 Ok, here is what I want, very like Going back to certain previous commit and not modifying git history: Suppose my git log is like this: detour C detour B detour A Last good point I want to revert to "Last good point", while still keeping the detours in the history, but unlike Going back to certain previous commit and not modifying git history, I want to make it top again. So afterward my git log would like: Revert to last good point detour C detour B detour A Last good point I know the

Easiest way to bring back a previous commit point to the top in Git

人盡茶涼 提交于 2019-12-18 09:47:14
问题 Ok, here is what I want, very like Going back to certain previous commit and not modifying git history: Suppose my git log is like this: detour C detour B detour A Last good point I want to revert to "Last good point", while still keeping the detours in the history, but unlike Going back to certain previous commit and not modifying git history, I want to make it top again. So afterward my git log would like: Revert to last good point detour C detour B detour A Last good point I know the