How can I selectively merge or pick changes from another branch in Git?
2022-01-29
Question I'm using Git on a new project that has two parallel -- but currently experimental -- development branches: master: import of existing codebase plus a few modifications that I'm generally sure of exp1: experimental branch #1 exp2: experimental branch #2 exp1 and exp2 represent two very different architectural approaches. Until I get further along I have no way of knowing which one (if either) will work. As I make progress in one branch I sometimes have edits that would be useful in the other branch and would like to merge just those.…
Why can't I push to this bare repository?
2022-01-29
Question Can you explain what is wrong with this workflow? $ git init --bare bare Initialized empty Git repository in /work/fun/git_experiments/bare/ $ git clone bare alice Cloning into alice... done. warning: You appear to have cloned an empty repository. $ cd alice/ $ touch a $ git add a $ git commit -m "Added a" [master (root-commit) 70d52d4] Added a 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 a $ git push No refs in common and none specified; doing nothing.…
Can I get a list of files marked --assume-unchanged?
2022-01-28
Question What have I marked as --assume-unchanged? Is there any way to find out what I've tucked away using that option? I've dug through the .git/ directory and don't see anything that looks like what I'd expect, but it must be somewhere. I've forgotten what I marked this way a few weeks ago and now I need to document those details for future developers. Answer You can use git ls-files -v.…
How to Git stash pop specific stash in 1.8.3?
2022-01-28
Question I just upgraded Git. I'm on Git version 1.8.3. This morning I tried to unstash a change 1 deep in the stack. I ran git stash pop stash@{1} and got this error. fatal: ambiguous argument 'stash@1': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]' I've tried about 20+ variations on this as well as using apply instead of pop with no success.…
Is there a "theirs" version of "git merge -s ours"?
2022-01-28
Question When merging topic branch "B" into "A" using git merge, I get some conflicts. I know all the conflicts can be solved using the version in "B". I am aware of git merge -s ours. But what I want is something like git merge -s theirs. Why doesn't it exist? How can I achieve the same result after the conflicting merge with existing git commands? (git checkout every unmerged file from B)…
List files in local Git repo?
2022-01-28
Question I'm using SparkleShare, which uses Git to sync files between my laptop and my backup server. Now I want to be able to browse the files and dirs that I've uploaded to my server, but I do not know how. I understand that Git uses some sort of special file hierarchy and that I cannot just list my files, right? But what would I have to do to list them and browse my files?…
fatal: Not a valid object name: 'master'
2022-01-27
Question I have a private server running git 1.7 When I git init a folder it doesn't create a master branch. Cause when i do: git branch it doesn't list anything. When I do: git --bare init it creates the files. When I type git branch master it says: fatal: Not a valid object name: 'master'. Answer When I git init a folder it doesn't create a master branch This is true, and expected behaviour.…