From 07b60ee544752526ad96305620d26d7103f3b066 Mon Sep 17 00:00:00 2001 From: Rico Haas Date: Tue, 28 Oct 2025 22:51:33 +0100 Subject: [PATCH] Add git tricks: mini branches and stashing --- 01_version_control/my_favorite_neat_little_git_trick_demo.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/01_version_control/my_favorite_neat_little_git_trick_demo.md b/01_version_control/my_favorite_neat_little_git_trick_demo.md index ad4521c0..273fe7d2 100644 --- a/01_version_control/my_favorite_neat_little_git_trick_demo.md +++ b/01_version_control/my_favorite_neat_little_git_trick_demo.md @@ -4,7 +4,7 @@ - Preparation should not take longer than 15 mins, should be a demo. - Lecturers also prepare some. -## Tricks from Winter Team 2025/26 +## Tricks from Winter Term 2025/26 - Click on line number on GitHub and then `blame` to study history of file - GitHub uses [gitignore templates](https://github.com/github/gitignore) if you create a `.gitignore` file from GitHub @@ -18,6 +18,9 @@ - If you rebased/merged and messed up your history, use `git reflog` to go back to a previous state - If you only need one file from another commit or branch, use `git checkout -- ` - Use [Git LFS](https://git-lfs.com/) for big files >10 MB or for non-diffable binaries (e.g., images, media, archives, shared libraries). +- Use `git switch -c ` to create a new branch and immediately check it out! +- Don't get stuck thinking that branches are only used as feature branches or issue branches! You can always create a short-lived temporary branch for something small, like shelving an experimental change. +- If a temporary branch is still too much overhead for you, you can instantly stash your local changes with `git stash`. Restore your stashed changes later with `git stash pop`. ## Tricks from Winter Term 2024/25