Skip to content

Instantly share code, notes, and snippets.

@jordifebrer
Last active April 11, 2016 15:19
Show Gist options
  • Save jordifebrer/c29cbf59b5e5135f837c to your computer and use it in GitHub Desktop.
Save jordifebrer/c29cbf59b5e5135f837c to your computer and use it in GitHub Desktop.
Miscellaneous git stuff

miscellaneous git stuff

Ammend the commit message

$ git commit --amend -m "New commit message"

Change name file to lowercase or uppercase

$ git mv uppercase_file temp_file
$ git mv temp_file lowercase_file

Revert last merge

$ git reset --merge ORIG_HEAD

Other option for reverting last merge and pushing the branch

$ git reset —hard HEAD^
$ git push -f

Adding git-completion

$ curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

# .bash_profile
if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

$ chmod +x ~/.git-completion.bash
$ source .bash_profile
touch ~/.gitignore_global
vim ~/.gitignore_global

... .DS_Store .DS_Store? ...

git config --global core.excludesfile ~/.gitignore_global
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment