0

I'm part of a time working with a remote repo. I recently installed a great Webpack plugin that plays a sound when Webpack finishes building the project. I love it but my team lead does not want it becoming part of the repo.

The problem is that every time I change branches, I have to reinstall the plugin and add it back to the webpack config. Sometimes, Git lets me get away with leaving it but sometimes it doesn't and tells me to commit or stash before proceeding with an action. I've done stashing but it becomes a pain because I need to constantly stash/un-stash and often rerun install/add and restart Webpack.

Is there any way I can make this part of Webpack and the project on my machine only in a way that is seamless and simple and doesn't affect anyone else?

CodyBugstein
  • 21,984
  • 61
  • 207
  • 363

1 Answers1

0

It seems the webpack config file has been added and committed to the repository. Usually such configuration files are not supposed to be committed as part of the repository from the beginning, because they vary a lot in different workspaces and cause conflicts if contributors commit and push their own versions. But as @BenPetty commented, a webpack config file should be committed. I am completely new to webpack, so please ignore my opinion here.

As it's already there and I have no idea about your repository, I'd suggest you try this workaround. Since you switch branches a lot, you could use git worktree to generate a worktree for every branch or even every revision. One worktree is independent from another and you can commit, pull or push in the worktree.

Say you have 3 branches dev1, dev2 and dev3. The repository is now on master. You can use git worktree add /foo/dev1 dev1 to create the path /foo/dev1, and dev1 is checked out in it. Run git worktree add /foo/dev2 dev2 and git worktree add /foo/dev3 dev3 for the rest two branches. This way, you don't need to switch branches or clone a new repo for another branch. You can just enter the worktree path and install the plugin.

When dev1 is done, you can use git worktree remove /foo/dev1 to remove the worktree /foo/dev1. If you manually remove the path /foo/dev1 first, you can then use git worktree prune to prune its information from the repository.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53
  • I disagree with your first point — webpack config should always be committed into the repository, as with any other build configuration files. – audeos Feb 19 '20 at 02:13