I downloaded an Android project from GitHub and rebuilt it myself in Android Studio, with a few modifications. I've now decided I'd like to redistribute the binary I created. The original project is available under the Apache 2.0 license, which means that I have to identify the files I've modified and put notices in them to say so.
To do this I want to put my version of the source back under Git control in AS and connect it to GitHub so I can compare my source with the original to identify the changed files.
I have a local file server where I'd want to create a remote repository for the project, that is:
local repo (desktop) -> remote repo (NFS file system) -> GitHub
I'm not confident enough with Git to know how to do this correctly, so I'd appreciate some advice.
If I were to try it myself and get it wrong, is there an easy way to reset everything (git-wise) so I can try again?
If you need to compare your project with the original one to list the files that have been changed between the two, you could add in your local repo a second remote pointing to the original repository, and then compare the main
(or master
) branch of both projects with git diff --name-only
.
# add a remote pointing to the original project on GitHub
git remote add origin_old <URL_GitHub>
# fetching the main branch from the original project
git fetch origin_old main
# listing only the files that have been changed between the two projects
git diff --name-only main origin_old/main
# in case the repo on the file server hasn't been added as a remote for your local
# repository yet, you can add it in the same manner we did for the original one.
# Like so, you can push new changes to it (e.g. `git push origin feature/xyz`).
git remote add origin <URL_File_Server_Repo>
If I were to try it myself and get it wrong, is there a easy way to reset everything (git-wise) so I can try again?
The only thing you could mess up in this scenario is to add the wrong remote. You can easily cancel that with the remove subcommand of git remote
.
# removing the remote origin2, if this is pointing to the wrong remote
git remote remove origin2