2 Replies - 354 Views - Last Post: 31 January 2019 - 11:27 AM

#1 wtp   User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 338
  • Joined: 08-December 11

Git or email files?

Posted 30 January 2019 - 08:21 PM

I started a new job 3 months ago, and I havn't appreciated how Git is set up in the projects. It's a JavaEE project with no build tools (maven, gradle).

There's tracked files in the projects like .classpath and .project that I would normally expect to see in the .gitignore. The reasoning for tracking these files is they're neccessary to build the project. If they were ignored, I think I'd have to do some extra setup steps or find these files to build the project. When we commit code we only stage the files we changed and leave .classpath ect. as unstaged. This can be annoying because you manualy add each file instead of all tracked ones. But that's not my main issue, I can always ignore these files locally with
git update-index --assume-unchanged <file>
and then I'm able to add all files before commiting.

My issue is me and a coworker are working on the same feature, and it would be very convinient if we could work on the same branch, and easily pull each others changes. I havn't been able to find a way to do this given how Git is setup.
Your local changes to the following files would be overwritten by merge:
Your local changes to the following files would be overwritten by merge:

Even if I "assume-unchaged" those files it says this. The only way I know to pull would be to undo the changes to these files, which will completly break my build. Is there a way I could leave these files as is and pull changes? We've been emailing our changes back and forth . Is there a different approuch I can take?

This post has been edited by wtp: 30 January 2019 - 08:25 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Git or email files?

#2 BetaWar   User is offline

  • #include "soul.h"
  • member icon

Reputation: 1647
  • View blog
  • Posts: 8,510
  • Joined: 07-September 06

Re: Git or email files?

Posted 31 January 2019 - 07:33 AM

My first thought is that, as you said, you maybe shouldn't be tracking those files if they need to be different for everyone... but there may be a few ways to go about using git for this.

The first one would be to see if git stash, git merge, and then git stash pop works out for your need - this sets your local changes (uncommitted ones) aside for a bit, then you merge in the other stuff, and attempt to re-apply your local changes. It may have a conflict, but with any luck it will let you do standard conflict resolution at that point.

The other option is way more heavy handed, but you could try setting the merge strategy to prefer your hunks in merge conflicts... it may also just say that it "merged" things while keeping everything the way you had it beforehand, so I am not sure that is the best solution.

One other alternative, which is honestly not much better than emailing files around, would be to send patches around - that way you are just sending a single file, but it is still sending files.

Is the other guy committing his .classpath and/ or .project files?

Maybe this is something as simple as someone doing things incorrectly.
Was This Post Helpful? 1
  • +
  • -

#3 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 984
  • View blog
  • Posts: 3,879
  • Joined: 13-June 14

Re: Git or email files?

Posted 31 January 2019 - 11:27 AM

What's the reason for not having a build system? How are you managing dependencies and going through the compile/test/package cycle for your application?
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1