git-checkout

To git checkout without overwriting data

How can you git-checkout without overwriting the data? I run git checkout master I get error: Entry 'forms/answer.php' would be overwritten by merge. Cannot merge. This is surprising, since I did not know that Git merges when I git-checkout. I have always run after the command separately git merge new-feature. This seems to be ...

Is there a git uncheckout?

With git clone there is the option -n wich prevents a checkout of HEAD after the repository is cloned. Is there a possibility to do this manually? Edit I think the option -n reads better in the manual than it actually is: After cloning with -n all my tools show that I still reside on the master branch; the only difference being that all...

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 stash blunder: git stash pop and ended up with merge conflicts

I did a git stash pop and ended up with merge conflicts. I removed the files from the file system and did a git checkout as shown below, but it thinks the files are still unmerged. I then tried replacing the files and doing a git checkout again and same result. I event tried forcing it with -f flag. Any help would be appreciated! chirag...

Get back the changes after accidental checkout?

The following was the status of my repo. [~/rails_apps/jekyll_apps/nepalonrails (design)⚡] ➔ gst # On branch design # Changed but not updated: # (use "git add/rm <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: _layouts/default.html # deleted...

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....

Why does git-rebase give me merge conflicts when all I'm doing is squashing commits?

We have a Git repository with over 400 commits, the first couple dozen of which were a lot of trial-and-error. We want to clean up these commits by squashing many down into a single commit. Naturally, git-rebase seems the way to go. My problem is that it ends up with merge conflicts, and these conflicts are not easy to resolve. I don't u...

Confusion about git checkout

I am confused about a behavior of git checkout. The documentation of git checkout says: --merge When switching branches, if you have local modifications to one or more files that are different between the current branch and the branch to which you are switching, the command refuses to switch branches in order to prese...

error: git checkout-index: unable to create file

What I am trying to do is a git clone on windows, but the parent repository exists in a unix machine. Am cloning using ssh to get a clone from UNIX to windows, and I get this weird error. error: git checkout-index: unable to create file <filename> This happens during the checkout step of a git clone. Can anyone help me? ...

git checkout certain files despite conflict

I frequently find myself wanting to checkout only certain files in a tree but cant because I have modified them locally and dont want the hassle of trying to figure out merge (I dont want to merge anything - I just want the git version of certain files). So how can I force a checkout of, for example, "db-backup*" where these files are s...

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...

Git: move changes between branches without working directory change

Use-case: every time I want to move commit from one git branch to another I perform the following sequence of actions: [commit into working branch] git checkout [branch-to-merge-into] git cherry-pick [target-commit] git push git checkout [working-branch] That works fine with the only exception - every time I perform 'git checkout' gi...