Git and GitHub Notes - fordsfords/fordsfords.github.io GitHub Wiki
I usually use the GUI, but knowing git command line is important, so I should get better at it.
LOOK! => GitHub usage via git
https://docs.gitlab.com/ee/topics/git/numerous_undo_possibilities_in_git/ - long page. Short version: if a modified file hasn't been "staged" yet:
git checkout -- file
If it is staged but not committed:
git reset HEAD file
If it is committed (need to experiment to understand):
git revert commit-id
- https://git-scm.com/docs/ - master documentation.
- Wiki-cheat-sheet#local-editing - git commands for local Wiki editing.
- https://product.hubspot.com/blog/git-and-github-tutorial-for-beginners
Take a directory and put it under version control. Note: does not start tracking any files.
git init
Check out an existing repo.
git clone https://...
Track and stage files.
git add *.c
Check status.
git status git status -s (or --short)
Check diffs.
git diff [file] (unstaged changes) git diff --staged [file] (staged changes)Commit files.
git commit git commit -m "Commit message" git commit -a (commits unstaged changes)
Stage untracking a file and remove file from working directory.
git rm file (need to commit later)