🧠
MY SECOND BRAIN
meBlogLinkedInGitHub
  • Second brain
  • AI - Artificial Intelligent
    • AI-labeling
    • AI-training
  • Books
  • Code
    • Linux
    • Gradle
  • Company
    • Interview
  • Computer science
    • Data Structures
    • Algorithms
    • Concurrency
  • Container
    • Docker
      • Docker | Private Docker Registry
    • Kubernetes
  • Distributed systems
    • Akka
    • Analytics
    • Delivery guarantee
    • Kafka
    • Rebalancing
    • RPC
      • gRPC
  • Food
    • Recipes
      • Tiramisu
  • Git
  • GH CLI
    • GH CLI | Pull Request
  • SSH
    • SSH bastion | SSH Jump host
    • SCP
  • Learning
  • Management
  • Reactive systems
  • System Design
    • CAP Theorem
    • Domain Driven Design
    • System Design Interview
    • Load Balancing
    • CDN
  • OCR
  • Productivity
    • Alfred
  • Health
    • Teeth
  • Devops
  • Data stores
    • Elasticsearch
    • Mongo
  • Germany
    • Berlin
      • Where is to buy Christmas trees in Berlin
    • Internet in Germany
      • Install custom router for telekom
  • Transport
    • Bikes
  • Travel
    • Russia
      • Moscow
        • Moscow Attractions
    • United Kingdom
  • Writing
    • Markdown
      • Markdown Tables
  • Programming languages
    • Java
      • Java | OCR
      • Java | Spring
      • JAVA | How to install multiple Java versions on macOS
    • Go
    • Kotlin
    • Python
  • Optimization
    • Email
      • Zero inbox
  • Finance
    • Investment
      • Online brokers
  • People
  • Security
    • SaaS Security
  • Unix
    • Shell
      • ZSH
  • Work
    • Feedback
Powered by GitBook
On this page
  • Git create branch
  • Git delete branch
  • Git delete local branch
  • Git delete remote branch
  • Git pipeline to rebase
  • Git squash my last commits
  • Links

Git

Git create branch

git checkout -b "<new_branch_name>" "<from_branch>"
git checkout -b feature_x main
git checkout -b feature_x
  • new_branch_name – is a name of your branch

  • from_branch – is a name of branch from which need to create new branch, could be empty, in that case will be used the current branch

Git delete branch

Git delete local branch

Syntax

git branch -D "<branch_name>"

Example

git branch -D feature_x

Git delete remote branch

Syntax

git push "<remote_name>" --delete "<branch_name>"

Example

git push origin --delete feature_x

Git pipeline to rebase

If you're on the branch feature_x and you need to pull changes from the main branch, then the next example will be useful

git fetch origin main # pull the latests changes from remote
git checkout feature_x
git rebase origin/main
git push --force

Git squash my last commits

git reset --soft HEAD~<number_of_commits_to_squash>
git commit -m "Squash commit meesage"
git push --force

Links

PreviousTiramisuNextGH CLI

Last updated 3 years ago

About squashing