Category Archives: git

Git tips

How do I discard changes in my working copy that are not in the index? git stash save –keep-index –include-untracked You don't need to include –include-untracked if you don't want to be thorough about it. or drop the stash git … Continue reading

Posted in git | Tagged | Leave a comment

gitsubree usage

Basic commands about subtree git subtree add –prefix=<prefix> <commit> git subtree add –prefix=<prefix> <repository> <ref> git subtree pull –prefix=<prefix> <repository> <ref> git subtree push –prefix=<prefix> <repository> <ref> git subtree merge –prefix=<prefix> <commit> git subtree split –prefix=<prefix> [OPTIONS] [<commit>] 1. Add … Continue reading

Posted in git | Tagged | Leave a comment

Adding an existing project to GitHub using the command line

Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub. Open Terminal. Change the current working … Continue reading

Posted in git, Mac, Mobile | Leave a comment

git squash

1. Add a global “squash” alias from bash git config –global alias.squash ‘!f(){ git reset –soft HEAD~${1} && git commit –edit -m”$(git log –format=%B –reverse HEAD..HEAD@{1})”; };f’ 2. ~/.gitconfig should now contain this alias: [alias] squash = “!f(){ git reset … Continue reading

Posted in git, Mac | Tagged | Leave a comment