Add git notes
This commit is contained in:
124
git/git-commands.txt
Executable file
124
git/git-commands.txt
Executable file
@@ -0,0 +1,124 @@
|
|||||||
|
LOG:
|
||||||
|
|
||||||
|
elements limit:
|
||||||
|
git log -2
|
||||||
|
|
||||||
|
patch:
|
||||||
|
git log -p
|
||||||
|
|
||||||
|
oneline:
|
||||||
|
git log --pretty=oneline
|
||||||
|
|
||||||
|
filters:
|
||||||
|
git log --since=2.weeks --author=trilolol --grep=keywords
|
||||||
|
|
||||||
|
function:
|
||||||
|
git log -S function_name
|
||||||
|
|
||||||
|
branches logging:
|
||||||
|
git log --decorate
|
||||||
|
or
|
||||||
|
git branch
|
||||||
|
|
||||||
|
|
||||||
|
Config:
|
||||||
|
|
||||||
|
levels:
|
||||||
|
git config --local
|
||||||
|
git config --global
|
||||||
|
git config --system
|
||||||
|
|
||||||
|
remove entry:
|
||||||
|
git config --unset <key>
|
||||||
|
|
||||||
|
replace working directory on push:
|
||||||
|
git config receive.denyCurrentBranch updateInstead
|
||||||
|
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
git status
|
||||||
|
|
||||||
|
Diff indexed - working dir:
|
||||||
|
git diff
|
||||||
|
|
||||||
|
Diff indexed - commit:
|
||||||
|
git diff --staged (или --cached)
|
||||||
|
|
||||||
|
|
||||||
|
Tools:
|
||||||
|
git difftool --tool-help
|
||||||
|
git difftool --tool=<smerge>
|
||||||
|
git difftool
|
||||||
|
|
||||||
|
|
||||||
|
Commits:
|
||||||
|
|
||||||
|
commit with message
|
||||||
|
git commit -m "message"
|
||||||
|
|
||||||
|
autoindex:
|
||||||
|
git commit -a
|
||||||
|
|
||||||
|
inlude current index in previous commit:
|
||||||
|
git commit --amend
|
||||||
|
|
||||||
|
|
||||||
|
Remove files:
|
||||||
|
|
||||||
|
Remove from repository:
|
||||||
|
git rm <file>
|
||||||
|
|
||||||
|
Remove from index:
|
||||||
|
git rm --cached <file>
|
||||||
|
|
||||||
|
Unindex:
|
||||||
|
git reset -- <file>
|
||||||
|
|
||||||
|
Move sequence (rm-add):
|
||||||
|
git mv <from> <to>
|
||||||
|
|
||||||
|
Revert changes:
|
||||||
|
git checkout -- <file>
|
||||||
|
|
||||||
|
|
||||||
|
Branches:
|
||||||
|
|
||||||
|
new branch:
|
||||||
|
git checkout -b <branch name>
|
||||||
|
или:
|
||||||
|
git branch <branch name>
|
||||||
|
или:
|
||||||
|
git switch -c <branch name>
|
||||||
|
|
||||||
|
switch branch:
|
||||||
|
git checkout <branch name>
|
||||||
|
или:
|
||||||
|
git switch <branch name>
|
||||||
|
|
||||||
|
|
||||||
|
Merging:
|
||||||
|
|
||||||
|
step 1, switch to original branch:
|
||||||
|
git switch master
|
||||||
|
step 2, run command specifying branch that will be merged in original:
|
||||||
|
git merge hotfix
|
||||||
|
|
||||||
|
conflicts:
|
||||||
|
git mergetool
|
||||||
|
|
||||||
|
|
||||||
|
Remote:
|
||||||
|
|
||||||
|
add:
|
||||||
|
git remote add <name> <url>
|
||||||
|
git remote add name trilolol@example.com:/var/www/folder
|
||||||
|
|
||||||
|
rename:
|
||||||
|
git remote rename <name1> <name2>
|
||||||
|
|
||||||
|
upload updates:
|
||||||
|
git push <name> <branch>
|
||||||
|
|
||||||
|
download updates
|
||||||
|
git pull <name> <branch>
|
||||||
41
git/git-submodules.txt
Executable file
41
git/git-submodules.txt
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
add submodule:
|
||||||
|
git submodule add [url]
|
||||||
|
|
||||||
|
|
||||||
|
config:
|
||||||
|
diff:
|
||||||
|
git config --global diff.submodule log
|
||||||
|
(git diff --submodule)
|
||||||
|
status:
|
||||||
|
git config status.submodulesummary 1
|
||||||
|
submodule commands:
|
||||||
|
git config submodule.recurse true
|
||||||
|
|
||||||
|
|
||||||
|
cloning:
|
||||||
|
git clone [url]
|
||||||
|
git submodule init
|
||||||
|
git submodule update / git submodule update --init
|
||||||
|
or
|
||||||
|
git clone --recurse-submodules [url]
|
||||||
|
|
||||||
|
|
||||||
|
change branch:
|
||||||
|
git config -f .gitmodules submodule.[name].branch [branch]
|
||||||
|
|
||||||
|
|
||||||
|
fetch updates for submodules
|
||||||
|
git submodule update --remote [name] (first update)
|
||||||
|
git submodule update --init --recursive (update all)
|
||||||
|
git submodule update --remote --merge (fetch and merge)
|
||||||
|
git pull --recurse-submodules
|
||||||
|
in case url changed:
|
||||||
|
git submodule sync --recursive
|
||||||
|
|
||||||
|
|
||||||
|
upload updates for submodules:
|
||||||
|
git push --recurse-submodules=(check/on-demand)
|
||||||
|
|
||||||
|
|
||||||
|
other:
|
||||||
|
git submodule foreach '[command]'
|
||||||
Reference in New Issue
Block a user