Questions tagged [git-skip-worktree]
10 questions
50
votes
8 answers
Not Possible to switch branch after --skip-worktree
WHAT I WANT TO DO
I have a file which contains sensitive datas so I don't want to push content of this file to remote server.
WHAT I DID?
To achieve this, I made a commit when the file was empty and pushed this empty file to server (GitHub). And…

Eray
- 7,038
- 16
- 70
- 120
28
votes
1 answer
Handling changes to files with --skip-worktree from another branch
On my machine, I've set --skip-worktree to config/database.yml.
git update-index --skip-worktree config/database.yml
Another developer has committed and merged into the develop branch changes to config/database.yml while working on the…

Andrew Grimm
- 78,473
- 57
- 200
- 338
20
votes
1 answer
Git Skip Worktree on All Tracked Files inside Directory and its Subdirectories
Let's say I have this worktree that has already been tracked by git.
.
├── parent
│ ├── child1
│ | └── file1.txt
│ ├── child2
│ | ├── file2.txt
│ | └── grandchild
│ | └── file3.txt
│ ├── somefile.txt
│ └──…

kucinghitam
- 414
- 3
- 12
9
votes
1 answer
Does git update-index --skip-worktree affect the upstream repo?
I've been working with git for a while myself, and am now setting up a repo for our team. We develop a eCommerce platform.
There are a few directories and files to be ignored, such as the upload directory and environment specific config files.
While…

jgangso
- 638
- 10
- 19
2
votes
0 answers
Git checkout changes skip-worktree files
In my git repo, my config files (which are different on the features and master branch) have the skip-worktree bit on. Everything worked fine until I did a rebase on a local branch. This overwrote my local config files on my features branch.
So to I…

adarshdec23
- 231
- 2
- 9
1
vote
2 answers
Git switch branches with changed --skip-worktree file
I have an file abc.log that is (for some reason) tracked in git, but that I (perhaps foolishly) set as --skip-worktree so changes to it would not show up in my commits to the repository. I would like to change branches:
~ % git checkout master …

Kaia
- 862
- 5
- 21
1
vote
0 answers
Git locally ignore files by file-extensions
I want to locally ignore files by file-extensions. The files are tracked in Git but updated frequently on my machine. They should not be tracked by git anymore (so that git status or git add . would not be clogged with hundreds of files) but also…

JaBe
- 664
- 1
- 8
- 27
1
vote
2 answers
git skip-worktree on files with merge conflict
I have a configuration file abc.cfg with local changes for my environment. To prevent pushing local configs to the remote, I use git update-index --skip-worktree abc.cfg on the file.
Now the upstream has changed abc.cfg with global updates that I…

Xun Yang
- 4,209
- 8
- 39
- 68
0
votes
2 answers
Keeping local files with --skip-worktree flag intact on git pull
I have a similar situation like this: Link
Basically, I have a file called settings_data.json in my repository. I have --skip-worktree flag set on this file, so that if I make changes on my local machine, I don't accidentally push those changes to…

bmandl
- 19
- 6
0
votes
2 answers
Using skip-worktree on a file that is modified by git hooks?
I have a post-commit hook that edits a specific source file (specifically, writes commit hash to a string in c# class). Script is:
#!/bin/sh
hashStr=`git log --pretty=format:'%H' -n 1`
str="public static class GitHash { public static readonly string…

defaultUsernameN
- 365
- 5
- 14