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 main
git merge upstream/main

Or, if you prefer rebasing:

git rebase upstream/main

4. Push the updated main to your fork

git push origin main

Thursday, 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

If you’ve ever run 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 to main to encourage more inclusive naming practices.
  • Result: Local Git (depending on your version) may still default to master, while hosted platforms default to main.

⚙️ What Happens in Practice

  • Running git init on older Git versions → creates master.
  • 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 main as the default globally

    git config --global init.defaultBranch main
    

    This ensures all new repos start with main.

  • Rename an existing branch

    git branch -m master main  
  • git pull origin main --allow-unrelated-histories
  • git push -u origin main
  • git push origin --delete master   # optional
    
  • Adjust per project
    If your team still uses master, you can keep it. GitHub/GitLab let you change the default branch in repo settings.


🚀 Best Practice

For modern projects, it’s best to standardize on main. This avoids confusion when collaborating, matches GitHub/GitLab defaults, and keeps your workflow consistent.

Conclusion

The difference between 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 main and master separately (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 main to remote:
                    git push origin main

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 g...