Github - aliciamarie15/Cave_Funfair GitHub Wiki
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.
To create a local copy of a remote repository:
git clone <repositoryURL>
To view the current status of your working directory:
git status
To download changes from the remote repository without applying them:
git fetch
To fetch and integrate changes from the remote repository into your current branch:
git pull <remote> <branch>
To upload local commits to the remote repository:
git push <remote> <branch>
-
Stage Changes:
Or stage all changes:
git add <file>
git add .
-
Commit Changes:
git commit -m "Your commit message here"
-
Undo Unstaged Changes:
git checkout -- <file>
-
Unstage Changes:
git reset <file>
-
Amend Last Commit:
git commit --amend
-
Soft Reset (keep changes in working directory):
git reset --soft <commitHash>
-
Hard Reset (discard all changes):
git reset --hard <commitHash>
To temporarily save uncommitted changes:
git stash
Reapply stashed changes:
git stash apply
List all stashes:
git stash list
- Compare working directory changes to the last commit:
git diff
- Compare changes between two branches:
git diff <branch1> <branch2>
-
Check Current Branch:
git branch
-
Create a New Branch:
git branch <branchName>
-
Switch Branches:
git checkout <branchName>
-
Push a Branch:
git push origin <branchName>
To merge a branch into the current branch:
git merge <branchName>
When conflicts occur:
- Edit conflicted files to resolve issues.
- Stage resolved files:
git add <file>
- Complete the merge:
git commit
-
Delete a Local Branch:
Forced deletion:
git branch -d <branchName>
git branch -D <branchName>
-
Delete a Remote Branch:
git push origin --delete <branchName>
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.