简体   繁体   中英

How to create local for remote branch and push changes to remote using GIT

I have a master branch. I created a local-feature-branch from master and pushed changes to remote-feature-branch.

After pushing this, someone my local-feature-branch was lost. Now, how do i re-use the latest changes from the remote-feature-branch and create the same local-feautre-branch. Before re-using the latest changes from remote-feature-branch, i need to get latest from master and push it to -remote-feature-branch

Once created, if i make any changes to the local-feature-branch, how do i push this to remote-feature-branch.

This is a little confusing. can someone please help

I am not sure if I understand Your problem correctly, but my understanding is that You want to use the remote feature branch and merge it with master.

Let's name the feature branch feature-branch for the purpose of simplicity. I assume here that Your remote repository is named origin .

What You can do is:

git checkout origin/feature-branch
git rebase master
git push origin feature-branch --force

Alternatively, instead of rebase You can use merge to merge the master to Your branch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM