Skip to main content

Basics

semantic versioning

https://semver.org/

clone

  • git clone <url> clone an arbitrary repository

add

  • git add . add all files to stage

commit

  • git commit -m "some commit message" commit staged changes with inline commit message

checkout

  • git checkout <branch-name> checkout the branch with given name
  • git checkout -b <branch-name> create and checkout a new branch with given name

remotes

  • git push
  • git fetch
  • git pull

config

filemode

ignore filemod: git config (--global) core.fileMode false

store credentials

  • in plaintext in ~/.git-credentials
    • git config --global credential.helper store
    • add personal accesstoken to credetinal files:
      git credential approve << EOF
      protocol=https
      host=gitlab.com
      username=private-token
      password=<<your personal access token>>
      EOF
      
    • content in files:
    # ~/.gitconfig
    [user]
        email = myMail@mymail.com
        name = Me
    [credential]
        helper = store
    
    # ~/.git-credentials
    https://private-token:............@gitlab.com
    
  • in cache
    • git config credential.helper 'cache --timeout=<timeout>'
    • timeout in seconds (default 900 sec)

gitlab

gitlab personal access token

  • go to https://gitlab.com/-/profile/personal_access_tokens
    • rights: read_repository and write_repository
    • add line in ~/.git-credentials: https://private-token:{{token}}@gitlab.com

others