git-reset

How can I move commits from the trunk to a branch in Git?

I made a bunch of commits to the master and realized after the fact that they should have been in a branch. I've looked at various things about rebasing and merging and resetting the master. But no attempts at manipulation have yielded a history that looks like what I'm trying to do. My attempts lead me to believe it requires some comb...

How to go back to the last commit in the history after I used git reset to go to an older changeset?

Suppose my history goes that way : A - B - C - D (master) If I do git reset B, I'll got : A - B (master) Trouble is, git log now show me only the history from A to B, and I can't see C and D anymore. How can I go back to D ? ...

Is there a difference between "git reset --hard hash" and "git checkout hash"?

While reset and checkout have different usages most of the time, I can't see what difference there is between these two. There probably is one or nobody would have bothered adding a "--hard" option to do something the basic "checkout" can do. Maybe there is a difference is the way you will see the history? ...

Git: can't undo local changes (error: path ... is unmerged)

I have following working tree state $ git status foo/bar.txt # On branch master # Unmerged paths: # (use "git reset HEAD <file>..." to unstage) # (use "git add/rm <file>..." as appropriate to mark resolution) # # deleted by us: foo/bar.txt # no changes added to commit (use "git add" and/or "git commit -a") File foo/bar....

Git rename directory to another case same name shows containing files as modified always

After the directory TestDirectory was renamed to lower case (testdirectory) all it's files (a.html and b.html) are shown as modified and even git reset --hard doesn't reset the working tree. Git always says: # modified: TestDirectory/a.html # modified: TestDirectory/b.html Nothing works to reset the working tree to unmodified...

Move commits from master onto a branch using git

I'm trying to learn how to use Git effectively and I'm wondering how I should (good practice/bad practice?) solve the following case: Say I have the following chain of commits in master: Initial commit Commit 1 Commit 2 Commit 3 Then I realize that what's done in the last two commits is completely wrong and I need to start from Comm...

Is the full path required to unstage a file in GIT if am currenlty under a sub-directory?

Repo: mergetest $pwd /gitvobs/mergetest/apple $git status On branch br1 Changed but not updated: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) **modified: inside** $git checkout inside error: pathspec 'inside' did not match any file(s) known to gi...