learn-git-milestones

Git Commands

Install Git

  1. See Install Git in README

Configure Git

  1. See Configure Git in README

  2. Other configuration commands

# Show settings and location of all Git config files (system, global, local)
git config --list --show-origin

Using Git

  1. Basic version control workflow
# Get the current status of the repository
git status

# Stage all the changed files
git add .

# Create a commit
git commit -m "Adds all the files"

# Do some more work and repeat...
  1. Comparing files
# Show changes in files 
git diff

# Show changes in specific files
git diff [filename]

# Show history of commits
git log
  1. Fetch, pull, and push
# Get information about updates on the remote repository
git fetch

# Download the updates from the remote repo
git pull

# <after you have made edits to your local>

# Push your commits to the remote repo
git push

Git Collaboration

  1. Git Branches
# See your current branch
git status

# Create a branch
git branch [branch-name]

# Switch to a branch and update the files in the working directory
git switch -c [branch-name]