Git & Version Control for App Projects

Track changes, branch safely and collaborate with Git, including the mobile-specific files you should and should not commit.

Beginner · about 5 hours · difficulty 2/5

Git records every change to your project so you can experiment without fear, collaborate, and trace when a bug appeared. Every mobile CI/CD pipeline you meet later starts from a Git repository.

The daily workflow

  • git clone, git status, git add, git commit, git push, git pull.
  • Create a branch per feature (git switch -c feature/login), open a pull request, merge after review.
  • Write small commits with clear messages so history is readable.

Mobile-specific concerns

  • Use a proper .gitignore: exclude node_modules, build/, .gradle, Pods/ (team choice), DerivedData and local IDE files.
  • Never commit secrets: keystores, .p12 certificates, provisioning profiles, API keys and google-services.json for production should live in a secret store or CI variables.
  • Lock files (package-lock.json, pubspec.lock, Podfile.lock) should be committed so builds are reproducible.
  • Tag releases (v1.4.0) so you can map store builds back to code.

Pitfalls

Committing a signing key to a public repo is a real and common mistake; if it happens, rotate the key immediately. Large binary assets bloat the repo; consider Git LFS for big media.

Good enough to move on: you can branch, commit, resolve a simple merge conflict and open a pull request on GitHub.

Key concepts

  • Commits, branches and merges
  • Remote repositories and pull requests
  • Resolving merge conflicts
  • .gitignore for mobile projects
  • Keeping secrets out of the repo
  • Release tags
  • Git LFS for large assets

Mini project

Put your hello-world app on GitHub with a correct .gitignore, develop a small change on a branch, and merge it through a pull request.

Check yourself

Your Android upload keystore was pushed to a public repository. What exactly do you do next?

Free resources