Github - aliciamarie15/Cave_Funfair GitHub Wiki

GitHub Commands Guide

When starting this project we barely had any experience with github thus this guide provides an overview of the most commonly used GitHub commands to help manage and maintain projects effectively.


General Workflow Commands

Cloning a Repository

To create a local copy of a remote repository:

git clone <repositoryURL>

Checking Repository Status

To view the current status of your working directory:

git status

Fetching Updates

To download changes from the remote repository without applying them:

git fetch

Pulling Changes

To fetch and integrate changes from the remote repository into your current branch:

git pull <remote> <branch>

Pushing Changes

To upload local commits to the remote repository:

git push <remote> <branch>

Working with Changes

Staging and Committing Changes

  1. Stage Changes:
    git add <file>
    Or stage all changes:
    git add .
  2. Commit Changes:
    git commit -m "Your commit message here"

Undoing Changes

  1. Undo Unstaged Changes:
    git checkout -- <file>
  2. Unstage Changes:
    git reset <file>
  3. Amend Last Commit:
    git commit --amend

Resetting Changes

  1. Soft Reset (keep changes in working directory):
    git reset --soft <commitHash>
  2. Hard Reset (discard all changes):
    git reset --hard <commitHash>

Stashing Changes

To temporarily save uncommitted changes:

git stash

Reapply stashed changes:

git stash apply

List all stashes:

git stash list

Comparing

Comparing Changes

  1. Compare working directory changes to the last commit:
    git diff
  2. Compare changes between two branches:
    git diff <branch1> <branch2>

Working with Branches

Managing Branches

  1. Check Current Branch:
    git branch
  2. Create a New Branch:
    git branch <branchName>
  3. Switch Branches:
    git checkout <branchName>
  4. Push a Branch:
    git push origin <branchName>

Merging Branches

To merge a branch into the current branch:

git merge <branchName>

Resolving Merge Conflicts

When conflicts occur:

  1. Edit conflicted files to resolve issues.
  2. Stage resolved files:
    git add <file>
  3. Complete the merge:
    git commit

Deleting Branches

  1. Delete a Local Branch:
    git branch -d <branchName>
    Forced deletion:
    git branch -D <branchName>
  2. Delete a Remote Branch:
    git push origin --delete <branchName>

Using a .gitignore File

For Unity projects, use the standardized .gitignore file: Unity .gitignore. Place the file at the root of your project to prevent unwanted files from being tracked.

⚠️ **GitHub.com Fallback** ⚠️