cd
dir_namels
,l
mkdir
dir_namepwd
cp
file1 file2mv
file1 file2rm
file2
git init
git add
file_namegit config user.name
'Oleg Cybulsky'git config user.email
'alogic-ru@yandex.com'git commit -m
'Commit description'-m
'Next string description'git remote add origin
'repository_name'git remote -v
# check connected remote repositorygit push -u origin master
# push master branch to remote servergit status
# show staged and modified filesgit restore --staged <file>
# unstage file, modifications peservedgit restore <file>
# undo changes in modified filegit reset --hard <commit hash>
# move HEAD to commit, remove commits abovegit diff
# checks commited version against modifiedgit diff --staged
# checks commited against stagedgit diff <commit1> <commit2>
# show changes between commits
# ignore all .a files
*.a
# but do track lib.a, even though you're ignoring .a files above
!lib.a
# only ignore the TODO file in the current directory, not subdir/TODO
/TODO
# ignore all files in any directory named build
build/
# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt
# ignore all .pdf files in the doc/ directory and any of its subdirectories
doc/**/*.pdf
To get remote branches localy:
git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git checkout "${remote#origin/}"; done
or just:
git branch -r | grep -v '\->' | while read remote; do git checkout "${remote#origin/}"; done
To keep password for remote in memory for a few minutes:
git config --global credential.helper cache
graph LR;
untracked -- "git add" --> staged;
staged -- "???" --> tracked/comitted;
%% example arrow without text:
A --> B;