🌟
z's
  • Hello
  • Cheatsheets
    • 🍂Docker Compose Services
    • 🌿Git
    • ▶️ Golang
      • Gotchas
    • ⛑️Helm
    • ☸️ Kubernetes Management
    • ☸️ Kubernetes Resources
    • ☸️Kubernetes Snippets
    • 🔨Tools Quicklinks
    • Tools and Useful Stuff
    • 🟠Using Ubuntu
    • Reference/Template Dockerfiles
  • How-Tos
    • Use Ubuntu
    • Use VSCode
    • Use AWS
    • Use Git
    • Use GPG keys
    • Use Digital Ocean
  • About Me
    • Want to work with me?
    • How to work with me
  • Useful Tools
    • Collaboration
      • Miro
    • Documentation
      • Gitbook
      • Notion
  • On Growing People
    • Ontological Coaching
    • Organization Development (OD)
    • Speech Acts
    • Books & Other Resources
  • On Creating Software
    • Product
    • Design
    • Development Environments
      • Introduction
      • Visual Studio Code/Codium
      • Public Key Infrastructure (PKI) Setup & Usage
    • Patterns
      • API Authentication
      • User Authentication
    • Languages/Formats
      • JavaScript
      • Golang
      • HTML
      • CSS
      • SQL
      • JSON
      • YAML
    • Code Logistics
    • Data Persistence
      • Cassandra
    • Software Architecture
    • System Observability
    • Cool Tools
    • Kubernetes
      • Resource Cheatsheet
      • 1/ Kubernetes in 5 Minutes
      • 2/ Setting up Kubernetes locally
      • 3/ Handling long-running workloads
      • 4/ Handling run-once workloads
Powered by GitBook
On this page
  • Initialisation/Starting
  • Init a repository
  • Adding a Git remote
  • Change URL of Git remote
  • Clone a repository
  • Development
  • Adding an item to the Git repository
  • Remove an item from the Git cache
  • Creating a new branch
  • Rebasing from master
  • Squashing commits
  • Release
  • Listing all Git tags
  • Adding Git tag to current commit

Was this helpful?

  1. Cheatsheets

Git

Initialisation/Starting

Init a repository

git init

Adding a Git remote

# add using ssh
git remote add origin git@github.com:path/to/repo.git

# add using https
git remote add origin https://github.com/paht/to/repo.git

Change URL of Git remote

git remote set-url origin git@github.com:/path/to/repo.git

Clone a repository

# this will clone into a new directory named 'repo'
git clone github.com/path/to/repo.git

# this will clone into the current directory
git clone github.com/path/to/repo.git .

Development

Adding an item to the Git repository

# add everything in the current directory
git add .

# add a specific file
git add ./path/to/file

Remove an item from the Git cache

# remove a file
git rm --cache ./path/to/file 

# remove a directory
git rm -r --cache ./path/to/directory

Creating a new branch

git checkout -b branch-name

Rebasing from master

git checkout target-branch && git rebase master

Squashing commits

# squash ${N_COMMITS} commits into one commit
git rebase -i HEAD~${N_COMMITS};

Release

Listing all Git tags

git tag --list

Adding Git tag to current commit

git tag v1.2.3
PreviousDocker Compose ServicesNext▶️ Golang

Last updated 3 years ago

Was this helpful?

🌿