AKZN Notes

Archives for My Lazy and Forgetful Mind

Category: GIT

How to pull new branch from github

To pull a new branch from GitHub, follow these steps using Git: 1. Fetch the new branch from the remote repository: Run the following command to fetch all branches from the remote repository. This will not switch to the branch yet, but it will download the branch references. git fetch origin 2. List all branches […]

Deploy from GitHub to cPanel Using Webhook and Deployment Hook (No SSH Key)

Step 1: Set Up Git Version Control in cPanel: Log in to your cPanel account. Navigate to the "Git Version Control" section (or similar) and create a new repository or choose an existing one. Note down the repository URL provided by cPanel. This URL is used to push changes. Step 2: Configure GitHub Webhook: In […]

Git Archieve only Changed File and folder on current commit

tl;dr use syntax below git diff-tree -r –no-commit-id –name-only –diff-filter=ACMRT $commit_id | tar -czf file.tgz -T – $commit_id = commit sha id you want to archieve to know commit id git log To exit git log command press q key. Git Archieve only Changed File and folder on current commit To create an archive of […]

Archieving git master branch

first make sure you’re checkout to master branch git checkout master The correct syntax for zipping the master branch in Git using the git archive command with the output filename specified is: git archive –format=zip –output=[filename].zip HEAD This command creates a new zip file named master.zip containing the contents of the master branch. You can […]

Using Github Workflow to Auto Deploy to VPS

original tutorial https://viandwi24.medium.com/github-actions-sederhana-untuk-testing-dan-deploy-ke-server-vps-a43976cd6f46#5752 make new linux user with limited access/no sudo edit the yml workflow name: CI-Deploy-serv3 on: push: branches: [ master ] workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: – uses: actions/checkout@v2 with: fetch-depth: '0' ref: 'master' – name: Deploy to Serv 3 Dwbz uses: appleboy/ssh-action@master with: host: ${{ secrets.HOST_GITHUBCI_SERV3DWBZ }} username: ${{ secrets.USERNAME_GITHUBCI_SERV3DWBZ }} […]

Git deploy to VPS

for the impatients Set up the new bare repo on the server: $ ssh myserver.com Welcome to myserver.com! $ mkdir /var/git/myapp.git && cd /var/git/myapp.git $ git –bare init Initialized empty Git repository in /var/git/myapp.git $ exit Bye! Add the remote repository to your existing local git repo and push: $ cd ~/Sites/myapp $ git remote […]

Untrack files already added to git repository based on .gitignore

Let’s say you have already added/committed some files to your git repository and you then add them to your .gitignore; these files will still be present in your repository index. This article we will see how to get rid of them. Step 1: Commit all your changes Before proceeding, make sure all your changes are […]

How to merge two git branches that are in different repos/folders?

Combining two git repositories Use Case I have: folder_a/app_A folder_b/app_B I want to merge app_B into app_A and keep all history. How can I merge the branches together? switch to repo A cd folder_a Add repo B as a remote repository git remote add folderb /path/to/folder_b Pull B’s master branch into a local branch named […]