Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Lol I love when people start to learn version tracking and how to be a developer
-
Git fetch updates your git meta data from another server. Usually the origin. This is because git is decentralized. Fetch syncs the data of different instances.
Pull is the same as fetch && merge. If you use the rebase flag when pulling, it will rebase rather than merge. -
Merge will create a new commit that combines the changes together. This keeps the history intact, even if it gets messy with a bunch of small commits.
Rebase changes the git history to make it look like you branched off the new commit. This can keep the history cleaner but adds some complexity and risk. -
On a high level, fetch is only typically used when you want to see what’s been happening on some other “remote” (repository). Think of it like you are getting the local newspaper from the remote news source. After fetch you can checkout some branches/pointers/SHA’s that were created somewhere else.
-
@lungdart what “risk” does rebasing add? Rebasing is the ideal way to combine work.
-
b2plane63881y@lungdart @chonky-quiche
Seems like i still fucked up
Git fetch origin main command doesnt fix shit
When i use it and then push from infra branch and then merge to main it gets blocked due to conflicts telling me i need to rebase locally. When i rebase locally i get huge merge conflicts and the clusterfuck begins from there! -
b2plane63881y@chonky-quiche @lungdart @-zn-
Why the fuck do i have to
git pull
git merge origin main
Every single time i merge a side branch into main branch???
If i dont git merge then if i try to merge into main again i get conflicts -
b2plane63881y@-zn- so every time im on side branch i should git pull origin main on that branch before i commit changes on the side branch?
-
@b2plane by default, that will merge. As long as the repo maintainers are good with that work flow, it's fine.
-
b2plane63881y@lungdart it doesnt. It forces me to do
git pull
git merge origin main
That seems to be the only way to normally merge new commit changes into main branch
Why do i have to merge with main every time? Why cant git pull origin main do that? Why 2 commands and not 1?
If i have 2 branches on git
- main
- infra
You cannot push directly to main. It is forbidden. You can only merge to main
Now. Once i push to infra branch. Assuming all the shit went good pipeline passed tests passed etc. Then i merge it to main.
Now
Locally while im on infra branch. I have to pull latest changes from main otherwise ill fuck up everything and cause conflicts.
After trial and error i realized i just have to do:
git fetch
This fetches all shits from main (defaukt branch) into infra branch. And now it works. No rebase. No pull. Wtf?
Is this the correct way to do it?
Also i need someone to explain this to me like im 5:
- git pull
- git pull --rebase
- git fetch
What is the difference between those 3 commands? I tried googling and chatgpting but i cant seem to understand any explanation. Explain it to me in simple terms with examples
rant