2

I created a some_library_v1.jar and created an testApp to show how to use this jar and finally pushed the testApp on our server.

Then requirements were changed and I updated jar, replaced it with new name some_library_v2.jar and pushed the testApp again. But it turned out that Android Studio thinks that I only changed name of jar. As a workaround I just added old jar and pushed it again, so, now folder libs contains several versions of my library.

My question is how to make Android Studio understand that I have changed a library but not only jar's name?

Alexey Simchenko
  • 333
  • 3
  • 15
  • 2
    Binary files and VCS don't really get along well. If you have alternatives, you should avoid committing and pushing these. Some times you don't have a choice, but don't expect accurate result on diffing. Also, you should add a tag with whatever VCS you're using. – Zoe Apr 20 '19 at 16:04
  • 1
    @Zoe, I use Git – Alexey Simchenko Apr 20 '19 at 16:55
  • Yeah, generally speaking build artifacts (and other generated content) shouldn't be committed. Is there a specific reason you're doing this? – ChrisGPT was on strike Apr 20 '19 at 17:55
  • @Chris, I have to save a project with my jar on the server because another developer(s) have to have a real example of using that. Maybe I have to store that jar in some other folder? I mean, that I can write a comment in a code that last version of the jar exists in "some_folder" and he has to move it to libs folder and delete old jar from libs. – Alexey Simchenko Apr 20 '19 at 22:21
  • @LumisD, what does your server have to do with anything? Git isn't a deployment tool, it's a version control tool. If you're committing a `.jar` just so you can copy it somewhere your workflow is broken. – ChrisGPT was on strike Apr 21 '19 at 02:54

1 Answers1

1

Without discussing the best practice (ie, regenerate a jar from sources compilation), try instead:

git rm -- old.jar
git commit -m "Remove jar v1"

git add -- new.jar
git commit -m "Add jar V2"

That should be enough to record those events properly (and not as a "rename")

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250