GIT Recipes

1) Make the current commit the only (initial) commit in a Git repository?

git checkout --orphan newBranch
git add -A
git commit -m "Initial Commit"
git branch -D master
git branch -m master #rename the mastyer
git push -f origin master
git gc --aggressive --prune=all

Another Way:
git init
git add *
git commit -m 'Initial commit'
git remote add origin [repo_address]
git push --mirror --force

2) Preventing push to upstream repository
A way to avoid pushing into a repository is providing a dummy url address to the repository.
This is accomplished by issuing the git command:
git remote set-url --push upstream no_push

3) To fix Git Detached head issue with master.
Mostly small steps like this will fix it
a)git reset --hard
b)git pull
c)git checkout master

src :

Preparing my dev laptop with docker from scratch

Problem Statement:

To learn docker, kubernetes and cloud platform and use it for further learning spring boot and python development.


  1. Get a capable machine with minimum Intel I5 or equivalent processor virtualization support, 16GB RAM, 256GB SSD. I got my HP Pavilion Gaming Laptop 15 upgraded.
  2. Install OS which support virtualization and is supported by Docker. I got my laptop upgraded from windows 10 home edition to Windows 10 professional edition. which has now automatically upgraded to windows 11 pro. You can also install Linux OS like Ubuntu or Fedora as your host machine if you prefer.
  3. Created a personal GitHub Account and Docker Hub account…
  4. Installed latest version of Python 3, open JDK 11, Git-bash, Docker desktop for windows, Notepad++, Visual studio code and IntelliJ Idea Community edition for Java.
  5. I was able to create sample repo and sample docker container was up and running.

With base environment ready, I will now start exploring further.