terrydiederich2
1/10/2019 - 3:30 PM

Git Commands

Show details of origin

git remote show origin

Show remote branches

git branch -r

Pull changes from local_branch TO master

git checkout master
git merge local_branch

Pull changes from master TO local_branch

git checkout local_branch
git merge master

Checkout branch work-branch (create it based on dev if doesn't exist)

git checkout -b work-branch dev

Pull changes from remote, merge changes to local branch (will commit)

git checkout dev
git pull

git checkout work-branch
git merge dev

Delete local branch

git branch -d work-branch

Show log of changes

git log

This tells it to fetch the commits from the remote repository, and position your working copy to the tip of its master branch. All your local commits not common to the remote will be gone.

git fetch origin
git reset --hard origin/master

List previous commits, checkout and recreate previous branch

git reflog
git checkout [sha]
git checkout -b [branchname]

ToDo

git stash 

git stash list

git stash apply stash@{000}

git fsck
  if an dangling blobs or dangling commits

git gc

git branch -a

git branch remote show origin