Simple and beginner-friendly step-by-step guides to share your Android project in GitHub repository
The good thing about using Android Studio to upload your files to GitHub is it automatically figures out for you what files are required to commit and push to GitHub. For example, generated files are not required to commit and push to GitHub.
The following provides the step-by-step instructions on how you can upload your Android studio projects to GitHub:
Update: Feb 8, 2022: I learned that the
.idea folder is unnecessary to be committed to repository because those files are specific to IDE configurations, which could be different per developer. In this case, you can update the
.gitignore file to exclude them.
.gitignoreto ignore the entire
.ideafolder (optional step)
In your root project folder, you should see
.gitignore which have the following default ignore for certain files and folders in the
/.idea/caches /.idea/libraries /.idea/modules.xml /.idea/workspace.xml /.idea/navEditor.xml /.idea/assetWizardSettings.xml
To ignore the entire
.idea folder instead.
Click "Generate..." and follow the instructions to get the generated token
That is it. Your project now has been uploaded to your GitHub repository. After you make some local changes to your file, you need to commit and push those changes into a GitHub repository. The following steps show you how to do that.
- Click "commit" in the top right corner. You can also go to menu "Git→Commit"
You can also click "Commit" and push your files later on. To push your files, click "push" in the top right corner. You can also go to menu "Git→Push". The rest of the steps are very similar to "Commit and Push" above.
Another common thing I do before I commit the files is review my changes. The following steps show you how you can review and make any changes to your files in the committing screen.
- Select a file, right click and click "Show Diff"
- By default, it is "Unified viewer" which I don't like.
- Now you can review your change. You can also make changes to your file from this window.
Hope this helps! I’m new to GitHub and this is what I do to commit and push my Android projects into my GitHub repositories.
Originally published at https://vtsen.hashnode.dev.