(License: CC BY-SA 4.0)
Advantages:
git
is the program behind GithubCommon usage scenario:
git clone
gets working copy from repogit add <files...>
to select your changed filesgit commit
saves your changes into the version control history with a comment (Wash, rinse, and repeat step 2. Commit often!)git push
publishes your previous commits to remote repository (Github)git pull
receives latest changes from repo to syncgit diff
shows your changes from last repo versiongit log [filename]
lists all commits, optionally those touching a filename
git diff <commit>
shows changes in version labeled as <commit>
git checkout <commit>
rewinds all files back to a versionHint: use
git checkout <commit>
Many ways to do it, but recommended way:
master
or main
for releasesdevelop
for active developmentfeature-xyz
Relevant Git commands:
git switch xyz
for switching all your code to branch xyz
(without losing if you committed all)git merge xyz
for merging all the changes in branch xyz
onto current branchAvoiding bloating and conflict hell:
.gitignore
file: Add lines of file patterns to be kept out of your repo.Mac vs PC guy: different line endings:
core.autocrlf
will automatically convert for you!Removing already deleted files from your repo:
git add -u files...
Highly recommended visual interface: