Show git global (user level) configuration information
git config --global --list
Create global (aka user level) settings
git config --global user.name "Vivek Menon"
git config --global user.email "vivekmenon@dotnetanalysis.com"
Set notepad++ as the default editor for git (works in windows 64 bit)
git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Create a git repository
git init
View Pending Changes
git status
Add a new file (stage a new file) named play.txt to git
git add play.txt
Add all the untracked files into git in one command
git add *
Stage all existing files that has been updated
git add -u
Commit changes to local repository
git commit -m "adding a new file"
Stage and commit in one single command
git commit -am "my comment"
Show history
git log
(latest changes show up on the top)
(type q to exit)
Show difference between the last two commits
git diff Head~1 Head
(Head is the latest commit. Head~1 means one before the latest)
Delete a file hello.txt
git rm hello.txt (stage for deletion)
git commit -m "delete hello.txt" (commit deletion)
Get back the deleted file hello.txt
do git log to see all the commits
do git checkout <SHA-1 hash of the commit I need> hello.txt
Undo all changes that have not been staged or committed
git reset --hard
git config --global --list
Create global (aka user level) settings
git config --global user.name "Vivek Menon"
git config --global user.email "vivekmenon@dotnetanalysis.com"
Set notepad++ as the default editor for git (works in windows 64 bit)
git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Create a git repository
git init
View Pending Changes
git status
Add a new file (stage a new file) named play.txt to git
git add play.txt
Add all the untracked files into git in one command
git add *
Stage all existing files that has been updated
git add -u
Commit changes to local repository
git commit -m "adding a new file"
Stage and commit in one single command
git commit -am "my comment"
Show history
git log
(latest changes show up on the top)
(type q to exit)
Show difference between the last two commits
git diff Head~1 Head
(Head is the latest commit. Head~1 means one before the latest)
Delete a file hello.txt
git rm hello.txt (stage for deletion)
git commit -m "delete hello.txt" (commit deletion)
Get back the deleted file hello.txt
do git log to see all the commits
do git checkout <SHA-1 hash of the commit I need> hello.txt
Undo all changes that have not been staged or committed
git reset --hard
No comments:
Post a Comment
Comments will appear once they have been approved by the moderator