botbotbot 's blog


Git Rebase

Michael Crichton said, “Great books aren’t written– they’re rewritten.”

fatal: CRLF would be replaced by LF in …

Because there is differenced end of line in dos and unix.

# open file that error in vim
:set noendofline binary

Global Ignore

# set where is global gitignore file
$ git config --global core.excludesfile ~/.gitignore_global
# write some ignore file in global gitignore
$ echo "tags" >> ~/.gitignore_global

Git stash

git stash
git stash pop
git revert

Git Alis

git config --global alias.tree "log --graph --decorate --oneline --abbrev-commit"
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"

Git Taggin

$ git tag -a <tag name> <commit id> -m “desc"
$ git push origin —tags
$ git pull --tags

Keep file in a Git repo, but don’t track changes

Should keep database.php.example and config.php.example in the repo. Then add config.php and database.php to the .gitignore file.

Remove sensitive files and their commits from Git history - GitHub answered exactly that question as an FAQ

pick out individual commits

cleaning up untracked files


  1. git replacing LF with CRLF
  2. Generating SSH Keys
  3. Anatomy Of A Good Commit Message
  4. Stop using git pull: A better workflow
  5. - Create Useful .gitignore Files For Your Project
  6. Git คืออะไร ? + พร้อมสอนใช้งาน Git และ Github
  7. Git Pro Book
  8. Git Ready Tips
  9. Keeping A GitHub Fork Updated
  10. Understanding the Git Workflow
The intended workflow is:

Create a private branch off a public branch.
Regularly commit your work to this private branch.
Once your code is perfect, clean up its history.
Merge the cleaned-up branch back into the public branch.
  1. Learn Git Branching
  2. 2013 - Git For Ages 4 And Up
  3. A Tale of Three Trees
  4. Try Git: Git Tutorial
  5. Git Commit Good Practice - OpenStack
  6. Becoming a Git Master
  7. Lesser known Git commands
  8. Git from the inside out
  9. Oh shit, git!