Skip to content

Instantly share code, notes, and snippets.

@xotonic
Last active December 14, 2016 14:54
Show Gist options
  • Save xotonic/cecf29d8da44f55a18c6d9b2234b62cb to your computer and use it in GitHub Desktop.
Save xotonic/cecf29d8da44f55a18c6d9b2234b62cb to your computer and use it in GitHub Desktop.
Common and useful git commands

Create new branch

git add *
git checkout -b my_new_branch
git commit -m "My risky changes"
git push --all origin

Delete deleted files from whole repo

git add -u :/

git grog [alias]

Commit tree

git config --global alias.grog 'log --graph --abbrev-commit --decorate --all 
--format=format:"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)"'

git commend [alias]

Add files after commit and commend

git config --global alias.commend 'commit --amend --no-edit'

Usage

git add Dockerfile
git commit -m ‘Update Bitbucket pipeline with new Docker image’
# (facepalm)
git add bitbucket-pipelines.yml
git commend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment