Last active
February 9, 2023 18:50
-
-
Save anwas/a0414c2c19f11b262351030bbb5d1089 to your computer and use it in GitHub Desktop.
[GIT install, config and snippets] #git #snippets #alias
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git init | |
git add . | |
git commit -a -m "Initial commit" | |
git tag -a 1.0.0 | |
git tag -n | |
git checkout -b develop master | |
git checkout -b feature-clean-footer develop | |
git checkout develop | |
git merge --no-ff feature-clean-footer | |
git branch -d feature-clean-footer | |
git push origin develop | |
git checkout -b feature-another-feat develop | |
git checkout develop | |
git merge --no-ff feature-another-feat | |
git branch -d feature-another-feat | |
git push origin develop | |
git checkout -b release-1.1.0 develop | |
# pakeisti failuose versijos numerį į 1.1.0 (su scenarijumi arba rankiniu būdu) | |
find ./ -type f -exec sed -i -E '/(@since)/!s/1.0.0/1.1.0/g' {} \; | |
git commit -a -m "Bumped version number to 1.1.0" | |
git commit -a -m "Only Small bugfix" | |
git checkout master | |
git merge --no-ff release-1.1.0 | |
git tag -a 1.1.0 | |
git checkout develop | |
git merge --no-ff release-1.1.0 | |
git branch -d release-1.1.0 | |
git checkout -b hotfix-1.1.1 develop | |
# pakeisti failuose versijos numerį į 1.1.1 (su scenarijumi arba rankiniu būdu) | |
find ./ -type f -exec sed -i -E '/(@since)/!s/1.1.0/1.1.1/g' {} \; | |
git commit -a -m "Bumped version number to 1.1.1" | |
# Ištaisyti skubias klaidas | |
git commit -m "Fixed severe production problem" | |
git checkout master | |
git merge --no-ff hotfix-1.1.1 | |
git tag -a 1.1.1 | |
git checkout develop | |
git merge --no-ff hotfix-1.1.1 | |
# ARBA, jei šiuo metu yra neužbaigtas release branch | |
git checkout release 1.1.0 | |
git merge --no-ff hotfix-1.1.1 | |
# ir jei develop branch negali veikti be hotfix, tai tik tada ir į ją suliejame | |
git checkout develop | |
git merge --no-ff hotfix-1.1.1 | |
## ir ištriname hotfix branch | |
git branch -d hotfix-1.1.1 | |
git config --global alias.tree 'log --graph --decorate --pretty=oneline --abbrev-commit' | |
git config --global alias.co checkout | |
git config --global alias.br branch | |
git config --global alias.ci commit | |
git config --global alias.st status | |
git config --global alias.cm '!git add -A && git commit -m' | |
git config --global alias.unstage 'reset HEAD --' | |
git config --global alias.undo 'reset --soft HEAD~1' | |
git config --global alias.last 'log -1 HEAD' | |
git config --global alias.difflast 'diff --cached HEAD^' | |
git config --global alias.graph "log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset'" | |
git config --global alias.clone-branches '! git branch -a | sed -n "/\/HEAD /d; /\/master$/d; /remotes/p;" | xargs -L1 git checkout -t' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssudo add-apt-repository ppa:git-core/ppa | |
sudo apt-get update | |
sudo apt install git git-core | |
which git | |
git --version | |
git config --global user.name "An Was" | |
git config --global user.email "[email protected]" | |
git config --list | |
cat ~/.gitconfig | |
git config --global core.editor "'/usr/bin/subl' -n -wl1" | |
git config --global color.ui true | |
touch ~/.gitignore_global | |
git config --global core.excludesfile ~/.gitignore_global | |
cat ~/.gitconfig | |
cd ~ | |
curl -OL https://github.com/git/git/raw/master/contrib/completion/git-completion.bash | |
mv git-completion.bash ~/.git-completion.bash | |
nano .bashrc | |
# \W – tik paskutinė path dalis, \w – visas kelias, \h – hostname, \u – username. | |
export PS1='\[\033[0;32m\]\h:\[\033[36m\]\w\$\[\033[0m\] > ' | |
if [ -f ~/.git-completion.bash ]; then | |
source ~/.git-completion.bash | |
export PS1='\[\033[0;32m\]\h:\[\033[36m\]\w$(__git_ps1 "(%s)")\[\033[0m\] > ' | |
fi | |
. ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment