main
  • About
  • Civil Engineering
    • Interview questions
    • Bridge design
  • Google Cloud
    • Code samples
    • kafka
    • Cloud Run
    • persistent disks
    • Spinnaker
    • Assessment questions
    • IAM
    • Cloud Storage
    • VPC
    • Cost optimization
    • Compute Engine
    • App Engine
    • Cloud Vision
    • Spanner
    • Cloud SQL
    • Solutions
      • Static IP - WIP
      • Network performance
      • Building a VPN
      • Build a streaming app
      • ML train with taxi data
    • Dataproc
    • Dataprep
    • BigTable
    • Cloud Fusion
    • Data flow
    • CloudFront
    • APIGEE
    • BigQuery
    • Cloud logging
    • Pubsub
    • Identity Aware Proxy
    • Data center migration
    • Deployment Manager
    • Kubeflow
    • Kubernetes Engine
    • Istio
    • Read the following
    • Storage for cloud shell
    • kms
    • kpt
    • Hybrid cloud with Anthos
    • helm
    • Architecture
    • terraform
    • Network
    • Data studio
    • Actions
    • Jenkins
  • Data Processing
    • Data Lake
    • Data ingestion
    • Data Cleaning - Deduplication
    • Data Cleaning - Transformation
    • Data cleaning - rule definition
    • ETL
  • Machine Learning
    • Tensorflow
    • Tensorflow tips
    • Keras
    • Scikit-learn
    • Machine learning uses
    • Working with Pytorch
    • Federated learning
  • AWS cloud
    • Billing
    • Decrease volume size of EC2
    • Run CVE search engine
    • DataSync
    • EC2 spot instances
  • Java
    • Java
    • NIO
    • System Design
      • Zero trust framework
    • Collections
  • Azure
    • Enterprise Scale
    • API
    • Resource group
    • Create an sql database
  • UBUNTU
    • No Release file
    • STRATO blockchain
    • iperf
    • Rsync
    • curl
    • Shell
    • FAQ - git
  • PH test
    • Syllabus
    • Opportunities
    • Aptitude test
  • Development
    • Course creation
    • web.dev
    • docfx template
  • npm
  • Docker Desktop
  • Nginx
  • English rules
  • Confluent
  • sanity theme
  • Java Native Interface tutorial
  • Putty
  • Personal website host
  • Google search SEO
  • Reading a textbook
  • DFCC Progress
  • STORAGE
    • Untitled
  • Services Definition
    • Cloud VPN and routing
  • Microservices design and Architecture
    • Untitled
  • Hybrid network architecture
    • Untitled
  • Deployment
    • Untitled
  • Reliability
    • Untitled
  • Security
    • Untitled
  • Maintenance and Monitoring
    • Peering
  • Archive
    • parse dml to markdown
Powered by GitBook
On this page

Was this helpful?

  1. UBUNTU

FAQ - git

PreviousShellNextSyllabus

Last updated 4 years ago

Was this helpful?

How do I undo 'git add' before commit?

git reset

.

Reset local repository branch to be just like remote repository HEAD

git reset HEAD

.

How do I checkout a remote Git branch

git fetch j143 <branch-name>

How do I delete a Git branch locally and remotely?

git branch -d -r origin/branch-name

.

How to change URI for a remote git repository

git remote set-url --add <name> <new-url>

.

git remote add

How do I push a new local branch to a remote git repository and track it?

git push --set-upstream origin new-local-branch

How do I revert a git repository to previous commit?

git reset commit-SHA --hard

How can I add empty directory to a git repository?

We cannot add empty directory. But, we need to keep a file .gitkeep or .gitignore or just .keep file with empty contents.

specifying git add <dir> would add dir/file1 and dir/file2.

.

https://git-scm.com/docs/git-reset#Documentation/git-reset.txt-Undoadd
https://git-scm.com/docs/git-reset#Documentation/git-reset.txt-emgitresetemltmodegtltcommitgt
https://git-scm.com/docs/git-branch#Documentation/git-branch.txt-Deleteanunneededbranch
https://git-scm.com/docs/git-remote#_synopsis
https://git-scm.com/docs/git-add#Documentation/git-add.txt-ltpathspecgt82308203