Practice and personal use
Day-to-day use
Taking this workshop further into your daily practice, the simplest thing to do is to
immediately start using Git in your projects. For example, if you are working on something
at the moment, run
git init in the folder and add whichever files are in there (take a
copy first if you are still nervous about losing anything, but you will soon learn to
trust these tools!).You will likely find on the first commit that many files that don't need to be in stored.
For example, say one of your scripts always generates a file in
out/log.txt, then you
could add out/ to a new .gitignore.If you are a Windows user and have followed this workshop using Windows Subsystem for
Linux (WSL) as suggested, then bear in mind that the WSL is a sandboxed environment;
today we have set up
git config and SSH for Ubuntu running in WSL but not for your
personal PC.To use git directly in Windows, you will have to download the installer from
https://git-scm.com. The installer provides a tool
called Git Bash which is a custom Windows terminal that has unix-like features (for
example in Windows there is no
ls command, but Git Bash provides this, along with
all basic unix tools like cat, ssh-keygen and grep).Start a Git Bash terminal and run
git config as we did during setup and then add a
new SSH key for your personal PC. You will now be able to use Git directly on your
Windows PC.We have avoided using Git Bash today whilst using the command line interface to get
familiar with remote server usage. You may also find a few subtle differences between
Git Bash and a true Linux/BSD operating system - for example the folder structure
and the line endings on files - and using WSL has helped us bypass these.
README.md and LICENSE
You find that the majority of Git repositories contain these two files.
README.md
is a welcome page for new users and LICENSE users how they can use the repository.The
.md signifies the README is in markdown format. Markdown is regular plain text
that uses certain characters for nicer formatting. For example the header of this
section is written as ## README.md and LICENSE where the hash symbols indicate
different types of heading.Version control platforms like GitHub and GitLab will show the formatted version
of
README.md directly underneath the file list, so it's a good place to state
what the project does and ideally how to use it. Some projects have very detailed
READMEs, but you will find even a brief description will help other users find
their bearings.Without a
LICENSE file, other users will not legally be allowed to use your
code; no license implies that your work is closed source. When you create a new
repository, you can choose to automatically add a particular type of license.
If in doubt and you're happy to share your work, use a permissive license like MIT.
The content of the LICENSE file is plain text.Going further
We've deliberately focused on the command-line interface to Git throughout this
course, because it's universally available and makes Git's behaviour explicit. Once
you're comfortable, you may want to explore the following.
Optional advanced modules
The remaining modules in this course are optional and marked (Advanced). Come
back to them whenever you meet the problem each one solves:
- Rebasing and Squashing - produce a clean, linear history.
- Finding Bugs with git bisect - locate the commit that introduced a bug.
- Multiple Remotes and Self-Hosting - work with more than one remote and run your own Git server.
Graphical clients
For day-to-day work you may prefer a graphical interface to Git:
- GitHub Desktop: Windows and macOS (and Linux).
- GitKraken: Windows, macOS, and Linux.
Most IDEs (VS Code, PyCharm, RStudio) also have Git integration built in.
Related courses
- Collaboration on GitHub - feature-branch workflow, Pull Requests, code review, GitHub Issues, and the fork-and-pull model.
- Continuous Integration
- automatically test and check your code on every push using GitHub Actions.
Books and tutorials
- Pro Git: the free, comprehensive Git book.
Key Points
- Start using Git in your own projects straight away -
git init, add your files, and commit. - Give every repository a
README.md(what it does) and aLICENSE(how others may use it). - Windows users can use Git directly via Git Bash, repeating the
git configand SSH setup there. - The optional (Advanced) episodes (rebase, bisect, the Git toolbox, multiple remotes) are there when you need them.