Git
- Background
- Git is the most popular distributed version control system (VCS)
- Originally created by Linus Torvalds, creator of Linux,
in 2005
- git is British English slang that means "unpleasant person"
- GitHub (owned by Microsoft) hosts public and private repositories, accessible using git
- Online resources for learning git
- Interactive tutorial
that takes 15 minutes
-
Learning Version Control with Git online book
- git tutorials
- Create a repository on GitHub
- README.md text file containing Markdown that indicates who developed the software, how it should be used, etc.
- .gitignore file specifies what files should be ignored and not included in the repo (usually files that are created in the build process)
- A license indicates how the software can and cannot be used
- Basic workflow
- Clone the repo on GitHub (origin) onto your local machine
- Modify the local repo (add functionality, fix a bug, etc.)
- Commit your changes (save the current state of your repo) with a meaningful comment. Ex: Fix division-by-zero error, Add ability to save file
- Push changes to origin (copies all commits to GitHub repo)
- Alternate workflow
- Clone the repo on GitHub onto your local machine
- Create a branch in your repo
- Modify your branch (add functionality, fix a bug, etc.)
- Commit and push changes to your branch
- Create a pull request to ask collaborators for feedback on your changes
- Address review comments
- Merge your pull request into the main branch
- Delete your branch
- Using Git
- Advanced git users use the command line interface
- Requires memorizing numerous commands and arguments
- Helpful to keep a
cheat sheet
- GUI clients are usually easier to use
- Many options available
- GitHub Desktop is free and ideal for working with GitHub
- SourceTree is free and very popular
- All clients allow use of command line interface as well
- Many IDEs have built-in git functionality
- Git experience in Visual Studio
- How to Use Git in Android Studio