git overwriting local ignored files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

It seems that git is overwriting my local files on merge if they're in .gitignore. See command transcript below. I searched `git help config` and Google, but I couldn't find any way to prevent it. Am I missing something? (The reason I care about ignored files is that I'm using git with a working directory of $HOME to manage my dotfiles, and most files in my $HOME are not tracked by git but are still important.)

dseomn@solaria:~$ mktemp -d
/tmp/tmp.RHyyMxJ5Zp
dseomn@solaria:~$ cd /tmp/tmp.RHyyMxJ5Zp
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp$ git init --bare repo.git
Initialized empty Git repository in /tmp/tmp.RHyyMxJ5Zp/repo.git/
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp$ git clone repo.git foo
Cloning into 'foo'...
warning: You appear to have cloned an empty repository.
done.
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp$ git clone repo.git bar
Cloning into 'bar'...
warning: You appear to have cloned an empty repository.
done.
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp$ cd foo
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ echo '*' > .gitignore
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ git add -f .gitignore
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ git commit -m 'gitignore'
[master (root-commit) affd2fb] gitignore
 1 file changed, 1 insertion(+)
 create mode 100644 .gitignore
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ git push
Counting objects: 3, done.
Writing objects: 100% (3/3), 216 bytes | 216.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /tmp/tmp.RHyyMxJ5Zp/repo.git
 * [new branch]      master -> master
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ cd ../bar
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/bar (master)$ git fetch
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /tmp/tmp.RHyyMxJ5Zp/repo
 * [new branch]      master     -> origin/master
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/bar (master)$ git merge @{u}
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/bar (master)$ echo hi > quux
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/bar (master)$ git add -f quux
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/bar (master)$ git commit -m 'quux'
[master aee4b54] quux
 1 file changed, 1 insertion(+)
 create mode 100644 quux
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/bar (master)$ git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 273 bytes | 273.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /tmp/tmp.RHyyMxJ5Zp/repo.git
   affd2fb..aee4b54  master -> master
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/bar (master)$ cd ../foo
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ echo bye > quux
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ git fetch
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /tmp/tmp.RHyyMxJ5Zp/repo
   affd2fb..aee4b54  master     -> origin/master
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ cat quux
bye
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ git merge @{u}
Updating affd2fb..aee4b54
Fast-forward
 quux | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 quux
dseomn@solaria:/tmp/tmp.RHyyMxJ5Zp/foo (master)$ cat quux
hi

--
https://david.mandelberg.org/



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux