• Skip to main content
  • Skip to primary sidebar

Code Inherit

Simple Programming Code Examples

Uncategorised

Create a branch of specific commit in git or git hub

15th January 2024 by Site Admin Leave a Comment

To create a branch at a specific commit in Git or GitHub, you can use the following steps:

Git Command Line:

  1. Open your terminal or command prompt.
  2. Navigate to your Git repository using the cd command:

cd /path/to/your/repository

Find the commit hash you want to create a branch from using:

git log

  1. Copy the commit hash.
  2. Create a new branch at that commit using:

git branch new-branch-name commit-hash

  1. Replace new-branch-name with the desired branch name and commit-hash with the copied commit hash.
  2. Switch to the newly created branch:

git checkout new-branch-name

Or you can use a single command to create and switch to the new branch:

git checkout -b new-branch-name commit-hash

GitHub Web Interface:

  1. Go to the GitHub repository in your web browser.
  2. Click on the “Code” tab.
  3. Click on the “Branch: main” (or whatever your default branch is) dropdown.
  4. Type the name for your new branch in the “Find or create a branch” field.
  5. Click on the “Create branch: new-branch-name from ‘commit-hash'” button.

GitHub Command Line:

  1. Open your terminal.
  2. Clone the repository (if you haven’t already):

git clone https://github.com/your-username/your-repository.git

Navigate to the repository:

cd your-repository

Find the commit hash you want to create a branch from using:

git log

  1. Copy the commit hash.
  2. Create a new branch at that commit using:

git checkout -b new-branch-name commit-hash

  1. Replace new-branch-name with the desired branch name and commit-hash with the copied commit hash.
  2. Push the new branch to GitHub:

git push origin new-branch-name

These steps should help you create a branch at a specific commit either using the command line or GitHub’s web interface.

Filed Under: Uncategorised

How to delete git branch and git hub branch ?

15th January 2024 by Site Admin Leave a Comment

To delete a branch in Git, you can use the following steps:

Deleting Locally:

  1. Open your terminal or command prompt.
  2. Navigate to your Git repository using the cd command:

cd /path/to/your/repository

Delete the branch locally using the following command:

git branch -d branch-name

Replace branch-name with the name of the branch you want to delete. If the branch has unmerged changes, you might need to use -D instead of -d to force the deletion:

git branch -D branch-name

Deleting Remotely (GitHub, GitLab, Bitbucket, etc.):

If you want to delete the branch on a remote repository (e.g., GitHub), you can use the following steps:

  1. Open your terminal.
  2. Use the following command to delete the remote branch:

git push origin –delete branch-name

Replace branch-name with the name of the branch you want to delete.

Deleting Locally and Remotely in One Command:

If you want to delete both the local and remote branches in one command, you can use:

git push origin –delete branch-name
git branch -d branch-name

Again, replace branch-name with the name of the branch you want to delete.

Make sure to be cautious when deleting branches, especially if they contain unmerged changes. Always double-check that you are deleting the correct branch.

Filed Under: Uncategorised

Merge a specific commit to another branch

15th January 2024 by Site Admin Leave a Comment

To merge a specific commit from one branch to another in Git, you can use the git cherry-pick command. Here are the steps:

1. Identify the Commit Hash:

Use the git log command to find the commit hash of the specific commit you want to merge. For example:

git log

Copy the commit hash that corresponds to the commit you want to merge.

2. Switch to the Target Branch:

Make sure you are on the branch where you want to merge the specific commit. Use the following command to switch to the target branch:

git checkout target-branch

Replace target-branch with the name of the branch where you want to merge the commit.

3. Cherry-pick the Commit:

Use the git cherry-pick command to apply the specific commit to the current branch:

git cherry-pick commit-hash

Replace commit-hash with the actual commit hash you copied.

4. Resolve Conflicts (if any):

If there are conflicts during the cherry-pick process, Git will pause and ask you to resolve them. Open the conflicted files, resolve the conflicts, and then continue the cherry-pick process:

git cherry-pick –continue

5. Complete the Merge:

After resolving conflicts, if any, commit the changes:

git commit

6. Push the Changes:

If you are working in a shared repository and want to push the changes to the remote repository:

git push origin target-branch

Replace target-branch with the name of the branch you are merging into.

Now, the specific commit has been merged into the target branch. Note that cherry-picking creates a new commit in the target branch, and it doesn’t preserve the original commit hash.

Filed Under: Uncategorised

How to host react app in a subdirectory?

26th October 2021 by Site Admin Leave a Comment

1. REACT_APP_BASE_NAME=/dispensing-mock in .env

2. “homepage”: “/dispensing-mock”, in package.json

3. <BrowserRouter basename={process.env.REACT_APP_BASE_NAME}> in index.js

4. window.location.href = `${process.env.REACT_APP_BASE_NAME}/dashboard`; in loginPage.js

5. <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /dispensing-mock/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /dispensing-mock/index.html [L]
</IfModule>
in .htaccess in hosting directory

Filed Under: Uncategorised

How to create react native app ?

27th September 2021 by Site Admin Leave a Comment

  1. Install nodejs
  2. npm install –global expo-cli //run in cmd
  3. expo init my-project // run in cmd
  4. npm start / expo start // run in cmd
  5. expo build:android

Filed Under: Uncategorised

How to Install VPN Software in Windows 10

30th January 2021 by Site Admin Leave a Comment

http://www.firewall.cx/cisco-technical-knowledgebase/cisco-services-tech/1127-cisco-vpn-client-windows-10-install-fix-442-failed-to-enable-virtual-adapter.html

http://www.firewall.cx/cisco-technical-knowledgebase/cisco-services-tech/1165-cisco-vpn-client-windows-10-anniversary-update-break-and-fix.html

Step 1. Install “GVCSetup64_4.9.4.0306_EN.exe”
Step 2. Install “vpnclient-winx64-msi-5.0.07.0440-k9.exe”

Step 3 – Edit the Windows Registry – Fix the Reason 442: Failed to Enable Virtual Adapter Error

At this point, the workstation has a fresh installation of the Cisco VPN Client, but will fail to work and produce the well-known Reason 442: Failed to enable Virtual Adapter Error.

To fix this issue, follow the steps below:

  1. Open your Windows Registry Editor by typing regedit in the Search Windows area.
  2. Browse to the Registry Key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CVirtA
  3. From the window on the right, select and right-click on DisplayName and choose Modify from the menu. Alternatively, double-click on DisplayName:

For Windows 10 32bit (x86) operating systems, change the value data from “@oem8.inf,%CVirtA_Desc%;Cisco Systems VPN Adapter” to “Cisco Systems VPN Adapter”.

For Windows 10 64bit (x64) operating systems, change the value data from “@oem8.inf,%CVirtA_Desc%;Cisco Systems VPN Adapter for 64-bit Windows” to “Cisco Systems VPN Adapter for 64-bit Windows” as shown below:

The registry key now shows the correct DisplayName value data:

Filed Under: Uncategorised

  • « Go to Previous Page
  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Go to Next Page »

Primary Sidebar

Recent Posts

  • Bijoy Converter
  • How to amend previous commit with current changes in git and github?
  • How to install PHP 8.1 alongside PHP 7.4 using HomeBrew in MacOs?
  • Create a shell script to switch 7.4 to 8.1 and vice versa
  • How to reflect PHP8.1 to Apache in MacOS?

Recent Comments

    Archives

    • October 2025
    • September 2024
    • January 2024
    • July 2023
    • October 2021
    • September 2021
    • February 2021
    • January 2021
    • October 2020
    • September 2020
    • August 2020
    • May 2020
    • March 2020
    • February 2020
    • January 2020
    • November 2019
    • May 2019

    Categories

    • Couchbase
    • Cron Job
    • dhis2
    • Linux, MySQL
    • MySQL
    • Oracle
    • Oracle Client
    • PHP
    • SSL
    • Subdomain
    • Uncategorised
    • Wordpress
    • WP
    • Zip

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Copyright © 2025 · Genesis Sample on Genesis Framework · WordPress · Log in