The official website of Bipul Raman

Delete all commit history in GitHub


Problem Scenario🤔: You want to delete all commit history but keep the code in its current state.
Solution: In order to achieve this, Deleting .git folder may cause problems in your Git repository. Therefore follow below steps through command line to solve the above problem scenario.
Step 1: Checkout to some new branch
git checkout --orphan new_branch
Step 2: Add all the files
git add -A
Step 3: Commit the changes
git commit -am "commit message"
Step 4: Delete the master branch
git branch -D master
Step 5: Rename the current branch to master
git branch -m master
Step 6: Force update your repository
git push -f origin master
Note: This will not at all keep your old commit history.

Create Self-Signed Certificate (.cer & .pfx)


Steps to create self signed certificate on Windows:
  1. Open visual studio Developer Command Prompt as administrator  
  2. Execute below mentioned commands in sequential order. It will create a certificate with SHA.256 algorithm.You can modify parameters as per your requirements.
    Command format:
    makecert –a SHA256 -sv SAMPLE.pvk -n "cn=SAMPLE" SAMPLE.cer -b <start_date> -e <end_date> -r
    pvk2pfx -pvk SAMPLE.pvk -spc SAMPLE.cer -pfx SAMPLE.pfx
    Example:
    makecert –a SHA256 -sv "C:\Sample.pvk" -n "cn=Sample" "C:\Sample.cer" -b "10/22/2018" -e "10/22/2019" -r
    pvk2pfx -pvk "C:\Sample.pvk" -spc "C:\Sample.cer" -pfx "C:\Sample.pfx"
  3. Install the pfx file for current machine or current user as per requirements
References:
  1. https://docs.microsoft.com/en-us/windows/desktop/SecCrypto/makecert
  2. https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/pvk2pfx

UPDATE: (April 15, 2019)
Use this powershell command to create self signed certificate as MAKECERT command has been depretiated.

Keeping a fork up-to-date on GitHub


When you are contributing to an open source repository on GitHub, you are allowed to make pull request only through forked repository. In that case, you will always need to keep your fork updated/in-sync with origin/master. You can follow below approach through command line to do that:
  1. Clone your fork from Origin
    git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
  2. Jump to the root directory of your cloned fork
    cd {cloned fork path} e.g. cd D:\cloned\fork-repo
  3. Add remote from original repository in your forked repository
    git remote add upstream https://github.com/ORIGINAL-USERNAME/REPO-YOU-FORKED-FROM.git

    git fetch upstream
  4. Updating your fork from original repository to keep up with their changes
    git pull upstream master