How can you stay on your feature branch (Git)?

Say that I cloned the development branch of the project. Then, after development, I forked it and called it the / abc function.

As I work on my local / abc function, it is clear that the point I forked from will lag more and more behind what it looks like now. Perhaps I'm mostly confused by the git process ...

Does this mean that my feature / abc branch will lag more and more behind where it is currently developing since it was split from the old development version? Is this part of the git process and you just need to resolve any conflicts that might arise AFTER you finish working on the local function / abc, commit and push the remote item / abc, and then merge with

Is there a way to fetch changes from development without merging the work-in-progress changes into the / abc function? Or is it all about you having to work on quick and easy changes that can be quickly completed and merged to keep your feature branch behind?

+3


source to share


2 answers


You can periodically pull in changes from the development branch ...

git checkout develop
git pull
git checkout feature/abc
git merge develop

      



Your feature / abc branch is now up to date.

+4


source


The feature branch can be updated periodically.

First you need to make sure you have the latest changes from the remote (assuming you have a remote repo)

git fetch origin

      

Then you need to merge those changes into your remote development branch into your local development branch

git checkout develop
git merge origin/develop

      



Note: This checkout / merge process does the same as pulling into a development branch. I prefer to use fetch / merge as it gives me more control. For example, if you want to see which commits were added for development prior to merging with your local development branch, you can do git checkout origin/develop

then git log

.

Finally, you need to merge your local development branch into your local feature branch

git checkout feature
git merge develop

      

This will merge the changes in the development branch into your feature branch. No changes will be made to the development branch.

+3


source







All Articles