$ git config --list'
- git config --global user.name "Jay LaCroix"
- git config --global user.email [email protected]
- git config --global core.editor vim
- Note: Run the above commands without the --global option to set the parameters for a single project.
$ git config user.name (to show what the user's name is set to)
$ git init
$ git init --bare
$ git remote show origin
$ git rm
$ git rm --cached myfile.txt
$ git rev-list -n 1 HEAD -- <file_path>
$ git checkout <deleting_commit>^ -- <file_path>
$ git mv myfile myrenamedfile
$ git add <filename>
$ git commit
$ git commit -v
$ git commit -a
$ git commit -m "This is a message."
$ git show <checksum> (or tag id)
$ git diff
$ git diff | colordiff
$ git diff --staged (or git diff --staged | colordiff)
$ git log
$ git log -p -2
$ git log --stat
To view log with easier to read output: git log --pretty=oneline
$ git tag
Create an annotated tag (annotated tags vs lightweight tags are stored on the server as actual objects):
$ git tag -a v1.4 -m "my version 1.4"
$ git tag -a v1.2 <checksum>
$ git push origin <tag_id>
$ git push origin --tags
$ git branch
or:
$ git show-branch (more info)
$ git branch -v
$ git branch branch_name
$ git checkout mybranch
$ git checkout -b branch_name
$ git branch -d mybranch
$ git push origin mynewbranch
First checkout the branch you would like to merge into. Then:
$ git merge mybranchtomerge
Note: If there are conflicts, git adds conflict-resolution markers to the files that have conflicts so that you can open them manually and resolve the issues.
$ git remote -v
$ git remote add origin https://github.com/jlacroix82/Project_Name.git
$ git remote set-url --push --add origin <origin-url>
$ git remote set-url --push --add origin <additional-url>
$ git remote add <shortname> git://github.com/mygiturl/myproject.git
$ git remote rename current new
$ git submodule add https://github.com/scrooloose/nerdtree.git vim/bundle/nerdtree
$ git submodule status
$ git submodule init && git submodule update
$ git submodule foreach git pull origin master
- Delete the relevant section from the .gitmodules file
- Stage the .gitmodules changes (git add .gitmodules)
- Delete the relevant section from .git/config
- Run git rm --cached path_to_submodule (no trailing slash)
- rm -rf .git/modules/path_to_submodule
- Delete the now untracked submodule files
- Commit changes