Git Learnings
Monday, April 6, 2026
Friday, March 20, 2026
How to work with Meta‑Repository in GIT
Output looks like below:
We are grouping multiple git repository under single git repository using SubModules concept.
Each submodule is a git repository.
Steps:
Step 1: Create each git repository in GIT
- galleyiq-frontend-frontend
- galleyiq-scm-crm-scm-crm
- galleyiq-gms-customerportal-gms-customer
- galleyiq-lms-partner-lms-partner
git remote add origin https://github.com/BharathanBtech/galleyiq-meta.git git push -u origin main
If a new team member clones this meta repository needs to clone the repo and run the below command
git submodule update --init --recursive
Reason: if you clone, the repository will be empty.. After ran this command only git will pull
the latest code from the remote.
If the submodule commit is 10 and meta repo points to 7 means, running this command will get
7th commit code only not 10.
To get 10th commit, we have to pull the latest code on each submodule and add that to the meta repo.
git commit -m "Add submodules"
git commit -m "Add submodules"
git commit -m "Add submodules"
Friday, November 28, 2025
Sync fork with upstream
How to sync your fork with upstream
Here’s a safe and common way to update your fork:
1. Add the upstream remote (if not already added)
git remote add upstream https://github.com/activepieces/activepieces.git
2. Fetch the latest changes from upstream
git fetch upstream
3. Merge upstream/main into your local main
git checkout maingit merge upstream/main
Or, if you prefer rebasing:
git rebase upstream/main
4. Push the updated main to your fork
git push origin mainThursday, November 27, 2025
How to Delete Branch
Delete branch locally:
# If you're on the branch, first switch to another (e.g., master/main)
git checkout master or git checkout main
# Delete local branch
git branch -d branch_name # safe delete (won't delete if unmerged)
git branch -D branch_name # force delete (even if unmerged)
Delete branch from remote:
git push origin --delete branch_name
Thank you.
Saturday, November 22, 2025
Why Git Shows master but GitHub/GitLab Use main
Introduction
git init locally and noticed the default branch is master, but then created a repository on GitHub or GitLab and saw the default branch is main, you’re not alone. This difference often confuses developers, especially those new to Git. Let’s break down why this happens, what it means, and how you can align your workflow.🌍 A Bit of History
- Git’s original default branch: When Git was first created, the default branch name was
master.
- Shift to
main: Around 2020, platforms like GitHub and GitLab changed their defaults tomainto encourage more inclusive naming practices.
- Result: Local Git (depending on your version) may still default to
master, while hosted platforms default tomain.
⚙️ What Happens in Practice
- Running
git initon older Git versions → createsmaster. - Creating a repo on GitHub/GitLab → starts with
main. - When you push your local repo to GitHub/GitLab, you may end up with mismatched branch names unless you rename.
✅ How to Fix It
You have three main options:
Set
mainas the default globallygit config --global init.defaultBranch mainThis ensures all new repos start with
main.-
git branch -m master main git pull origin main --allow-unrelated-histories
git push -u origin maingit push origin --delete master # optionalAdjust per project
If your team still usesmaster, you can keep it. GitHub/GitLab let you change the default branch in repo settings.
🚀 Best Practice
main. This avoids confusion when collaborating, matches GitHub/GitLab defaults, and keeps your workflow consistent.Conclusion
master and main isn’t a bug — it’s a reflection of Git’s history and evolving practices. By configuring your local Git to use main, you’ll save yourself and your team from branch name mismatches.Thursday, November 20, 2025
Force Merge Unrelated Histories
Hi, I have created a git repository named Animals, In that default branch is main. But I have started developing in master branch and pushed all the changes in master branch.
Now, main branch is empty or it has only ReadMe.md file.
Now, I wants to have everything in main branch whatever present in master branch.
In my terminal, I moved to main repository using "git checkout main" and used "git merge master"
Now, I am facing an issue that Unrelated Histories, what should I do now?
Run this command from your main branch:
git merge master --allow-unrelated-histories
This tells Git:
“Yes, I know these branches don’t share a common ancestor — merge anyway.”
Why This Happens:
- You may have created
mainandmasterseparately (e.g., cloned, then created a new branch). - Git normally expects branches to share a common commit history.
After the Merge:
- Resolve any merge conflicts if prompted.
- Commit the merge.
- Push
mainto remote:
-
Introduction If you’ve ever run git init locally and noticed the default branch is master , but then created a repository on GitHub or Git...
-
Delete branch locally: # If you're on the branch, first switch to another (e.g., master/main) git checkout master or git checkout m...
-
Output looks like below: We are grouping multiple git repository under single git repository using SubModules concept. Each submodule is a g...
.png)