(leftovers)

CIS241

System-Level Programming and Utilities

git (leftovers)

Erik Fredericks, frederer@gvsu.edu
Fall 2025

Based on material provided by Erin Carrier, Austin Ferguson, and Katherine Bowers

CIS241 | Fredericks | F25 | 14-git-merging

Merge tools

As mentioned, there are other options

However, you can include them in the terminal process!

  • Meld, for example -
    • git config --global merge.tool meld
    • git config --global mergetool.keepBackup false

After encountering a merge conflict, run git mergetool

  • Still need to add/commit!
CIS241 | Fredericks | F25 | 14-git-merging

Stashing changes

git stash - temporarily save changes for later

  • Takes staged and unstaged changes to tracked files
  • Saves for later and removes changes from working directory

Use the -u option to also stash untracked files

git stash pop brings them back

  • Also possible to access more than just the recent stash!
CIS241 | Fredericks | F25 | 14-git-merging

Reverting commits

git revert <commit hash>

Examples:

  • git revert HEAD~1
  • git revert SHA (where SHA is a commit ID)
    • Don't need all of it, just the first handful of characters if they are unique!

Doesn't rewrite history - just makes a new 'revert' commit

CIS241 | Fredericks | F25 | 14-git-merging

Viewing previous versions

git restore --source=<commit> filepath

  • Can replace with branch name
  • Filepath can be . or use globbing (e.g., *.c)

git checkout <commit> filename

  • DON'T DO git checkout <commit> - detached HEAD state!

git show <commit>:filename

CIS241 | Fredericks | F25 | 14-git-merging
(c gitignore)

And last for now, ignoring files

Create a .gitignore file in your repo root and make sure you add it

  • git add .gitignore

Any file/directory name or glob will be ignored!

  • Helpful when using git add . to add everything!

For example, .vscode configs, Unity temp files, or secrets files

https://github.com/github/gitignore

.

VERY helpful when you are using an engine