Want a programming project to help you practice using git? From no coding experience to building your first app 📘Download my FREE programming guide here: henrikmdev.com/firstapp
Well detailed video guide..thnks a lot I am working with a group and we have been having issue collaborating with Git but with this I believe we are good now.
lets say I am working on a separate branch, add I want to pull from the main, is there a way for me to pull changes from the main without compromising the code I have written on my branch?
Yes, there are two main ways to merge the main branch with yours. You can either do a rebase which puts the main branch's code first in the commit history then yours. Or you can do a merge which takes the main branch's commits and brings them into yours. I actually made a video about this if you want to go into more detail how it works. Just search "How To Merge Git Branches" under my channel. Hope that helps!
Sorry, I'm not sure what you mean by "uat"? Can you clarify? It sounds like you're asking how developers use git professionally. I'm actually releasing a video about that this week! Stay tuned!
There are two branches, staging and master in remote repo. I only have master in my local repo. However i want to create a new branch from staging. How do i accomplish this
You need to do a git pull from the remote repo so that staging is in your local repo. When that's done, checkout the staging branch and do "git checkout -b new_branch_name" to make a new branch off of staging. Then you need to push that new branch at some point so that it's in the remote repo, otherwise it will remain local only.
A git merge merges one branch into your current branch. A pull request is a request to merge one branch into another which allows for other developers to review (and approve) the merge before merging the branch.
Hey henrik, just a small doubt, can't we just do the "git pull" in our feature branch to keep our branch updated with remote origin main, rather than doing "git pull" in main branch and then merging it in our feature branch
git pull will just update your feature branch with the remote feature branch updates. I think you can do "git pull origin main" to achieve what you're thinking. This will pull the remote main and merge it into your feature branch.
Sorry I don't understand your question. Could you provide more context? Git merge and git pull are different git operations. Git merge is when you merge another branch into your branch. Git pull is when you pull the most recent changes in the remote repo into your local repo.
@@henrikmdev, Thank you so much. Now, I understood it correctly, about the differences in git pull and git merge. My question was: when I was in your_new_feature branch (from the video example), what might happen if I do git pull instead of git merge main? [ But now it is clear. being in your_new_feature branch if I do git pull then actually I am pulling my own changes to the local repository, But if I want to add main branch changes to my local repository in that case I must be doing git merge main. Am I correct?]
You got it! In addition to that, git pull also brings in information about other remote branches. So say your coworker created a new remote branch, you need to do a git pull so that your local repo is aware about it. Only after a git pull can you do a git checkout to see his/her branch in your local repo
@@henrikmdev, In that case, is that like... let us say *person A* has his/her local repo then if *person A* is doing git pull of his/her coworker's remote repo in his/her own local repo... is that git going to show *only the changes between local repo and pulled remote repo?* and then if he/she wants to merge they must use git merge?
Yes, on the console if you do a git pull, git will show you only the changes that were brought in to your local repo and your local repo will be the same as the remote. Then you can do a git merge or git rebase to bring someone else's branch changes into yours
Thanks for the suggestion! Can you explain more which concept in particular you were struggling with that could be fleshed out better through a flowchart?
Want a programming project to help you practice using git?
From no coding experience to building your first app
📘Download my FREE programming guide here:
henrikmdev.com/firstapp
Very insight video for new beginner who never worked in company or organizations. Thanks
Glad it helped ☺️
Well detailed video guide..thnks a lot
I am working with a group and we have been having issue collaborating with Git but with this I believe we are good now.
Ohh nice, glad it was helpful for your team!
nice, really clear explanation
Thanks, glad everything made sense :)
That's really a detailed video, I'm going to subscribe for this quality content
Glad it was helpful 🙂 feel free to let me know if you have any questions.
Best video till far on git branch and all stuff.
Thanks! 😊
Thank you for your explanation, helped me a lot :)
You're welcome, glad it was helpful :)
very good video, very nice explanation with an example. thank you and please keep doing videos for each problems you got,
Thank you for the encouragement! I plan to make more helpful videos :)
Thank you so much kind sir!
You're welcome 🙂 glad it was helpful!
really helpful video
Glad it was helpful! 🙂
lets say I am working on a separate branch, add I want to pull from the main, is there a way for me to pull changes from the main without compromising the code I have written on my branch?
Yes, there are two main ways to merge the main branch with yours. You can either do a rebase which puts the main branch's code first in the commit history then yours. Or you can do a merge which takes the main branch's commits and brings them into yours. I actually made a video about this if you want to go into more detail how it works. Just search "How To Merge Git Branches" under my channel. Hope that helps!
how uat, dev works in branches. do you create different branch, like when clien need to provide uat sign off how it works?
Sorry, I'm not sure what you mean by "uat"? Can you clarify? It sounds like you're asking how developers use git professionally. I'm actually releasing a video about that this week! Stay tuned!
There are two branches, staging and master in remote repo. I only have master in my local repo. However i want to create a new branch from staging. How do i accomplish this
You need to do a git pull from the remote repo so that staging is in your local repo. When that's done, checkout the staging branch and do "git checkout -b new_branch_name" to make a new branch off of staging. Then you need to push that new branch at some point so that it's in the remote repo, otherwise it will remain local only.
Thanks a lot.
You're welcome!
What's the difference between merge (git merge) and merge pull request?
A git merge merges one branch into your current branch. A pull request is a request to merge one branch into another which allows for other developers to review (and approve) the merge before merging the branch.
Thanks, that was very helpful
Hey henrik, just a small doubt, can't we just do the "git pull" in our feature branch to keep our branch updated with remote origin main, rather than doing "git pull" in main branch and then merging it in our feature branch
git pull will just update your feature branch with the remote feature branch updates. I think you can do "git pull origin main" to achieve what you're thinking. This will pull the remote main and merge it into your feature branch.
@@henrikmdev Yeah henri, I was talking about git pull orgin main from feature branch. Thanks for the help. 😊
I have one question/doubt: what happens instead of git merge main if it is git pull from *your_new_feature* ?
Sorry I don't understand your question. Could you provide more context? Git merge and git pull are different git operations. Git merge is when you merge another branch into your branch. Git pull is when you pull the most recent changes in the remote repo into your local repo.
@@henrikmdev, Thank you so much. Now, I understood it correctly, about the differences in git pull and git merge. My question was: when I was in your_new_feature branch (from the video example), what might happen if I do git pull instead of git merge main? [ But now it is clear. being in your_new_feature branch if I do git pull then actually I am pulling my own changes to the local repository, But if I want to add main branch changes to my local repository in that case I must be doing git merge main. Am I correct?]
You got it! In addition to that, git pull also brings in information about other remote branches. So say your coworker created a new remote branch, you need to do a git pull so that your local repo is aware about it. Only after a git pull can you do a git checkout to see his/her branch in your local repo
@@henrikmdev, In that case, is that like... let us say *person A* has his/her local repo then if *person A* is doing git pull of his/her coworker's remote repo in his/her own local repo... is that git going to show *only the changes between local repo and pulled remote repo?* and then if he/she wants to merge they must use git merge?
Yes, on the console if you do a git pull, git will show you only the changes that were brought in to your local repo and your local repo will be the same as the remote. Then you can do a git merge or git rebase to bring someone else's branch changes into yours
Nice vid
Thanks :)
@@henrikmdev np
thankyou
You're welcome! 🤗
Explaination could have been better using flowchart /diagram.
Thanks for the suggestion! Can you explain more which concept in particular you were struggling with that could be fleshed out better through a flowchart?