git-reset

How to use git reset in netbeans?

南楼画角 提交于 2019-12-05 23:28:43
I want to undo my last commit in NetBeans. As I found the command is '$ git reset --soft HEAD~ ' but how can I do it in NetBeans7 IDE? Use Main menu: Team -> Git -> Reset... (NB 7.3.x) OR Use Main menu: Team -> Git-> Revert/Recover-> Reset... (or use the context menu) (NB 7.4) 来源: https://stackoverflow.com/questions/15447988/how-to-use-git-reset-in-netbeans

git rebase ate my commits ! Translate 'git reflog' output for me?

前提是你 提交于 2019-12-05 22:44:40
I had done five commits and I wanted to make them all into one commit before pushing them. For some reason I decided to try doing this by a different means than I usually use. FWIW: I was attempting to follow the instructions here http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html . I'll put a lot of detail below but you might want to skip down to the bottom of the question where I put the output of git reflog because I suspect that's what's significant here. So here's what I did - with all my changes committed I did : git rebase -i HEAD~5 and I was presented with the

Generic git reset to default upstream HEAD

南笙酒味 提交于 2019-12-05 18:07:01
Is there a syntax to reset to the current branch's default upstream HEAD? Something like: git checkout mybranch git reset --hard origin/mybranch where origin/mybranch can be generic for the current branch's upstream HEAD? The syntactic magic you want is part of a "revision specifier". These are documented in gitrevisions . The string @{upstream} (abbreviation, @{u} ), appended to a branch name, means "resolve the branch to its upstream". If you omit the branch name, git substitutes in HEAD , i.e., HEAD@{u} . This uses HEAD to find the current branch and then proceeds as if you had specified

Revert pushed branch to a concrete commit

江枫思渺然 提交于 2019-12-05 12:40:47
I have merged a dev branch (with constant, sometimes unstable changes) to our master branch (where we store the released, stable code). I want to restore the master branch to the state it was before like the merge with the dev branch had never happened (and that when in the future we merge the dev branch all changes that we will discard now will be merged "again"). This is the current status of the master branch and I want it to have the 'professional-1.1.2' commit/tag at the HEAD. I tried: $ git revert -n professional-1.1.2..HEAD fatal: Commit 9167e846a387c793edbc089c7ab6bd9eb8260456 is a

git remove commit on the server

对着背影说爱祢 提交于 2019-12-05 05:10:33
问题 i've made some mistakes about my project managed in git: reading some guides and some posts here I made this command: git reset --hard a77ec5f where the commint a77ec5f is the last 'good' commit after this, the files are right in my local copy, but if I do a git status : $ git status # On branch dev # Your branch is behind 'origin/dev' by 4 commits, and can be fast-forwarded. # nothing to commit (working directory clean) and now, how can I tell the server that the 4 commits that I'm behind

How do I change a commit message after a 'git-pull' auto-merge?

最后都变了- 提交于 2019-12-05 02:39:48
问题 Occasionally, my collaborators will "panic" when there is an automatic merge generated as the result a git-pull , and just accept the default commit message. Before this commit gets pushed, I want to be sure the message gets fixed, but --amend seems not to work. What is the best way to fix the message that's generated in this scenario. The best instructions I can come up with for them are git reset --soft HEAD~ git merge -m <message> <the tracked remote branch> but that seems a bit scary (

GIT Pull deleted my commit

痴心易碎 提交于 2019-12-04 09:29:41
After git pull I have done git reset hard to undo the merge with commit id before merge.Somehow my entire commit is gone and I cant the see the commit in history also. But I have the commit id , on git show command I can see my changes. How can I get back my changes and how to track what mistake I have done if you have the commit hash, and you have not run garbage collection, you can always go back to that commit with git checkout <sha1> . if you want to re-apply it on top of your current head, you could do git cherry-pick <sha1> 来源: https://stackoverflow.com/questions/6201802/git-pull-deleted

What does the double-dash [--] option do on git reset?

我的未来我决定 提交于 2019-12-04 02:33:07
I've seen commands like: git reset e542 -- readme.txt I understand this command puts in the index the contents of the file readme.txt from commit e542. But what's the -- option doing there? The git reset man page lists it as optional for the first two forms but I couldn't find what it means. git reset [-q] [<commit>] [--] <paths>… git reset (--patch | -p) [<commit>] [--] [<paths>…] -- separates branch names from file names, in case there is any ambiguity (if you have a branch and a file with the same name). If there are no ambiguities, you don't need the -- . Also as mentioned by Jonas

What happens to orphaned commits?

微笑、不失礼 提交于 2019-12-03 16:36:46
问题 I have a repo with four commits: $ git log --oneline --decorate 6c35831 (HEAD, master) C4 974073b C3 e27b22c C2 9f2d694 C1 I reset -- soft to the C2 commit and now I have a repo like so: $ git reset e27b22c --soft $ git log --oneline --decorate e27b22c (HEAD, master) C2 9f2d694 C1 Now I add an extra commit, so the log looks like this: $ git log --oneline --decorate 545fa99 (HEAD, master) C5 e27b22c C2 9f2d694 C1 What happened to commits C3 and C4 ? I haven't deleted them, so I assume they are

How do I change a commit message after a 'git-pull' auto-merge?

 ̄綄美尐妖づ 提交于 2019-12-03 16:33:51
Occasionally, my collaborators will "panic" when there is an automatic merge generated as the result a git-pull , and just accept the default commit message. Before this commit gets pushed, I want to be sure the message gets fixed, but --amend seems not to work. What is the best way to fix the message that's generated in this scenario. The best instructions I can come up with for them are git reset --soft HEAD~ git merge -m <message> <the tracked remote branch> but that seems a bit scary ( reset ) and error prone (the remote tracked branch has to be entered explicitly). Is there a simple way