Skip to main content

GIT commants I've found useful

Check files changed between branches

git diff --name-status master..devel

Check changes on file form different branch/commit

git diff commit_hash -- filename

Same as above between 2 branches/commits

git diff commit_hash master -- filename

Check full file history

git log -p -- filename

Check who broke production server :

git blame filename

Merge as one commit (need to commit afterwards) its not default like in normal merge:

git merge --squash branch

List of commits in git local storage

git reflog

Take(checkout) file from different branch/commit

git checkout develop -- filename
git checkout commit_hash -- filename

Reset current branch to remote:

git reset --hard origin/current_branch
git reset --hard origin/master

Save and depracate changes which were not commited

git stash
git stash save -a

Restore stash (by picking selected)

git stash list
git stash pop {0}

Comments

Comments powered by Disqus