burim:python:github-projects
Table of Contents
git merge
Headline
Github ssh
Github using ssh
https://kamarada.github.io/en/2019/07/14/using-git-with-ssh-keys/
Headline
example
git clone https://github.com/burimali/ubunut-pi4.git
git clone git@github.com:burimali/ubuntu-pi4.git
cd ubuntu-pi4
change files
git add .
git commit
git push
bitbucket
ssh://git@x.x.x.x:7999/smar/smarthome.git
gitignore
touch ~/.gitignore git config --global core.excludesFile ~/.gitignore echo debug.log >> .gitignore $ git rm --cached debug.log rm 'debug.log' $ git commit -m "Start ignoring debug.log"
.gitignore example
.gitignore *.log *.log* git rm --cached
git backup + exclude folders
# Ignore everything in repository root /*
# Files to not ignore !/.gitignore !/some_other_files
# Folder to not ignore !/puppet/
github cmds
# configs have three levels: repository, user, global
# {git config} command operates on all config files with --file=<pathname>
git config --list
git config --list --local
git config --list --global
git config --list --system
# config location and files in checking sequence: system/user/repo
ls "$PROGRAMFILES/git/etc"
cat ~/.gitconfig
cat ~/.config/git/config
cat .git/config
# must set at least email and name
git config --global user.email "my@email.com"
git config --global user.name "username"
# .gitignore user/repo
cat ~/.gitignore
cat .gitignore
cat .git/info/exclude
# list ignored files
git status --ignored
git status --short --branch --ignored
git ls-files --cached --ignored --exclude-standard
# set a standard for commit messages
# create ~/.commitmessage and add to config
git config --global commit.template ~/.commitmessage
# -------------------------------------------------- .gitignore
# collection .gitignore templates https://github.com/github/gitignore
# Create useful .gitignore files for your project https://www.gitignore.io/
# remember .gitignore is not retroactive
# create a file with .tmp extension
git log > wastherebefore.tmp
# create and commit .gitignore
echo *.tmp > .gitignore
git add .
git commit -m “adding gitignore”
git log > wilbeignored.tmp
git status
# global gitignore is not used by default, run the following to fix this
git config --global core.excludesfile ~/.gitignore
# -------------------------------------------------- shortcuts
# great collection of aliases:
# https://github.com/GitAlias/gitalias
# https://github.com/durdn/cfg/blob/master/.gitconfig
# git config <level> alias.<alias name> '<git commands>'
# check [alias] section of .gitconfig
cat ~/.gitconfig
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 "commit -m"
git config --global alias.cmu "commit --amend -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.cm '!git add -A && git commit -m'
# log formatting
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.tree 'log --graph --decorate --pretty=oneline --abbrev-commit'
# remove alias
git config --global --unset alias.cm
add git
- cat .gitignore
# Ignore everything in repository root /*
# Files to not ignore !/.gitignore !/etc/config/** !/test2.txt # Folder to not ignore !/usr/ /usr/* !/usr/local/ !/etc/ /etc/* !/etc/config/ #template sample #!/templates/ #/templates/** #!/templates/myTemplate/
- Creating a new repository on the command line
touch README.md git init
git add README.md git commit -m "first commit" git remote add origin git@x.x.x.x:222/rtxxla-w01.git git push -u origin master
- Pushing an existing repository from the command line
git remote add origin git@x.x.x.x:222/rtxxla-w01.git git push -u origin master opkg install openssh-client
for restoring the config
cd / git init git remote add origin ssh://git@x.x.x.x:xxx/xxx/rtxx.git git fetch --all git reset --hard origin/master
ubuntu install git
#!/bin/bash sudo add-apt-repository -y ppa:git-core/ppa sudo apt-get update sudo apt-get install git -y
burim/python/github-projects.txt · Last modified: 2024/02/23 17:33 by burim
