LFCS 4.1: Basic Git operations
Cloning, branching, merging, undoing a commit, ignoring files and tagging, against a shared repository on the same VM.
Before you start
The lab creates a bare repository at /srv/git/app.git with some history:
app.conf, a README.md, a committed debug.log, and a branch
feature/workers. Work as root, and clone it to /root/app; the lab grades
that clone and the repository in /srv/git. Set your name and email in Git
first.
Tasks
- Clone
/srv/git/app.gitto/root/app, create a branchfeature/motd, commit a new file on it, and push the branch. - On
main, change theworkersline inapp.confto a different value thanfeature/workersuses, commit it, then mergefeature/workersintomainand resolve the conflict. - Find the commit that last changed the
timeoutline inapp.conf, and undo that commit onmainwithout rewriting history. - Make Git ignore all
.logfiles, stop trackingdebug.logwithout deleting it from disk, and commit the change onmain. - Tag the current commit of
mainasv1.0with a message, and push the tag.
Hints
git config --global user.name,git clone,git switch -c,git push -u origin,git ls-remote origin.git merge, then edit the file,git addandgit commit;git log --oneline --graph.git blame app.conf,git revert..gitignore,git rm --cached.git tag -a -m,git push origin v1.0,git ls-remote --tags origin.