Git for web developers
Git for website builders from the first commit to working together through GitHub or GitLab: history and undoing changes, branches and merging, what does not belong in a repository and what to watch out for on Windows and on the server. The examples are tested in Git Bash from Git 2.55 for Windows (as of October 2026).
Git remembers every saved version of the files of a website: who changed what, when and why. Installing on Windows, the first settings, creating a repository and the first commits.
The history in Git is useless if you cannot read it and go back to it. What changed and when, how to discard a failed edit, fix the last commit and undo a wrong change – and how to rescue your work when undoing goes wrong.
Branches separate a feature in progress from the version running on the website. Creating and switching branches, merging, resolving conflicts, rebase and putting unfinished work aside.
A remote repository on GitHub or GitLab is a backup outside your computer and a place through which several people exchange changes. Logging in with an SSH key, pushing and pulling changes, a rejected push and tagging versions.
A repository is for the source files of a website, not for passwords, uploaded photos or libraries that can be installed again at any time. How to exclude them with a .gitignore file, how to stop tracking a file that is already in the repository and what to do when a password has got into the history.
Websites are often written on Windows and run on Linux, and Git has to reconcile line endings and letter case in file names between them. Settings that save trouble on Windows, and why the .git folder must not be accessible on the website.