GIT Commands
The following is a reference and examples of some GIT commands commonly used. This can serve as a cheat sheet.
Set Remote
Set the repository used for push and pull - the remote. Normally the remote is "origin", but this can be confirmed in the ".git/config" file.git remote set-url origin https://you.domain/repoList Branches
git branch -aRestore Files From “.git” Folder
git reset --hard HEADChange Branch
git checkout BRANCHCreate Branch
git branch BRANCHDelete Branch
git branch -d BRANCHForce Delete Branch
git branch -D BRANCHMerge Branch
We will switch to the branch we want to merg INTO - the target. So if we are going from branch into master, check out master, then merge. Note that the “--no-ff” option will preserve the branch in the history so it’s not linear (preferred as we can see what was done).git checkout TARGETBRANCH git merge --no-ff SOURCEBRANCH git pushRoll Repo Back to Prior Commit
git checkout COMMIT_SHARoll Repo to Current Latest Commit
git checkout master
Lago Vista Technologies