Difference between revisions of "HowToGit"
From Lost In Wonderlands
(→useful commands) |
(→useful commands) |
||
Line 42: | Line 42: | ||
# setting diff tool | # setting diff tool | ||
git config --global core.editor emacs | git config --global core.editor emacs | ||
− | + | # P4Merge | |
− | + | # Meld | |
− | + | # kdiff3 | |
− | + | # winMerge | |
− | + | # TortoiseMerge | |
# setting merge tool | # setting merge tool | ||
git config --global core.editor emacs | git config --global core.editor emacs | ||
+ | # P4Merge | ||
+ | # Meld | ||
+ | # kdiff3 | ||
+ | # winMerge | ||
+ | # TortoiseMerge | ||
git log | git log |
Revision as of 13:57, 26 April 2019
How To Git
NeXT Steps
here everything has yet to be done !
coming soon :
Everything You Always Wanted to Know on git [seldom]... (But Were Afraid to Ask)
a collection of links of interest
See also
useful commands
gitk gitk --all
git init git clone
git config --list git config --list --show-origin
git config --global user.name "Your Name Comes Here" git config --global user.email you@yourdomain.example.com
# setting editor #emacs git config --global core.editor emacs #vscode #vi, vim #nano #TextEdit # using notepad on window 64bits git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -nosession" # using notepad on window 32 bits git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -nosession"
# setting diff tool git config --global core.editor emacs # P4Merge # Meld # kdiff3 # winMerge # TortoiseMerge
# setting merge tool git config --global core.editor emacs # P4Merge # Meld # kdiff3 # winMerge # TortoiseMerge
git log git log --oneline git log -- file git log --oneline <filePath>
git status
git stash git stash pop
git fetch git pull git pull --rebase
git branch git branch -a git branch -r
git branch -D <branchname> git branch -m newNameOfLocalBranch git branch -m branchToRename newNameOfBranchToRename git branch --set-upstream-to=origin/nomBranchRemote nomBranchLocale
git tag
git checkout git checkout -b <branchname>
git cherry-pick <commit sha1> git cherry-pick --abort
git merge
get rebase git rebase -i git rebase --interractive --onto
git rerere can be activated and set to be used automatically by git rebase
git reflog
git reset
git diff git difftool git mergetool git diff <filePath> git difftool <filePath>
git add git add -a git add -p
git rm git mv git grep
git commit git commit -m "commit message text" git commit -p git commit --amend
git push git push origin nomBranche
git stash git stash pop git stash clear git stash applymvnc
git reset --hard origin/<myRemoteBranch>
alias: git config --global alias.newCommand 'Commande en entier sans le "git"' Exemple : git config --global alias.unstage 'reset HEAD --' Usefull ones : git config --global alias.st 'status' git config --global alias.co 'checkout' git config --global alias.cp 'cherry-pick'
git bisect
How-To
- how to get a file history
git log -- <filePath> git log <filepath>
- using reflog and git reset to cancel actions
- resetting
- cancelling the last pushed commit
git revert
- cancelling the last commit (not yet pushed)
git reset HEAD~
- resetting a local branch after the remote branch on the server
git reset --hard origin/<myRemoteBranch>
- This removes everything from the index, then just run:
git rm -r --cached .
- Applying a .gitignore file added well after having committed file
git rm -r --cached . git add . git commit -m ".gitignore is now working"
- patches
- create a patch
git diff >> patch file git format-patch patch-file
** accept a patch git apply patch_file