PDA

View Full Version : Birdman's Git questiions/statements



birdman
17-12-18, 02:13
I don't suppose anyone has the info on doing this via the Web:



I forked enigma2 2 weeks ago, and have my own branch(es) in my copy.
I now want to update master and Dev in my fork to be the same as the OpenVix/enigma2 git, and to do so in a way that doesn't leave extraneous commits on my copy.


Everything I've tried either resulted in a PR showing up in OpenVix/enigma2 git, or my copy having the update showing as a commit, which then messed up any further PRs I tried to create.

abu baniaz
17-12-18, 03:37
I could not find a way to sync once you commit to your copy of master or Dev branches.

I will add the sourcetree guide for synchronization with the main project later.

BTW, this is a locked thread, so don't expect replies from non moderators in this thread. I do this with all my guide threads to avoid spoils.

birdman
19-12-18, 02:13
Point 1
If you have already made changes to dev and master branches in your fork, save the changed files elsewhere.
START AGAIN.
Fork project
Create new branch
Re-add the changed files to your new branch of your fork (copy of project).That's the current state I am in.
The problem is that once I've created my own fork there seems to be no way to update the dev and master branches (using the Web interface) to the latest state of the OpenVix master (which is what I may well need to do in order to create my next branch from Dev before submitting the next PR).

birdman
04-03-19, 03:02
Everything I've tried either resulted in a PR showing up in OpenVix/enigma2 git, or my copy having the update showing as a commit, which then messed up any further PRs I tried to create.Based on info gleaned from here (and twol?) I now have this script to keep my local copy up-to-date, and push that to my github forks.


#!/bin/sh
#
# Script to update my local repository from the remote masters, then push
# that to my Web git copy.
#
# Assumes remote upstreams are added, e.g.:
# git remote add upstream https://github.com/OpenVIX/enigma2.git
#
# Also assume that:
# git config --global checkout.defaultRemote origin
# has been run, to set the default checkout
#

if [ $# -eq 0 ]; then
echo >&2 "Usage: git-updater.sh branch1 [branch2...]"
echo >&2 " (must be run inside the git repository)"
exit 2
fi

for branch
do
echo "Updating $branch..."
git checkout $branch
git fetch upstream
if [ "`git merge upstream/$branch`" = 'Already up-to-date.' ]; then
echo 'Already up-to-date.'
else
git push origin $branch
echo "...$branch updated"
fi
done

Huevos
21-10-19, 16:39
I don't suppose anyone has the info on doing this via the Web:



I forked enigma2 2 weeks ago, and have my own branch(es) in my copy.
I now want to update master and Dev in my fork to be the same as the OpenVix/enigma2 git, and to do so in a way that doesn't leave extraneous commits on my copy.


Everything I've tried either resulted in a PR showing up in OpenVix/enigma2 git, or my copy having the update showing as a commit, which then messed up any further PRs I tried to create.What you are really asking is how not to have merge commits in your repo. Simple answer is not to make merge commits.

If you want to keep your dev branch in sync with the official dev branch, do a pull rebase, not a pull merge.

If you are working on a new feature, pull rebase ViX/dev into your/dev branch. Then add a new (feature) branch at the tip of your/dev branch.

When you are done, push your/feature branch to github and make the PR using the web interface on github.

Once the PR is accepted it will show in ViX/dev branch.

To get it in your/dev branch pull rebase from ViX/dev branch.

Never commit any of you own material to your/dev branch.

------------------------------------------------------------------

In my own case, even though my fork is usually identical to ViX the commit history is very different. For me the only way out is cherry pick from my fork to OpenViX. This is because I didn't keep the dev branch clean of my own commits.

birdman
21-10-19, 16:54
What you are really asking is how not to have merge commits in your repo. Simple answer is not to make merge commits.The git fetch+push origin script in #7 (https://www.world-of-satellite.com/showthread.php?60570-GitHub-Creating-pull-requests&p=482679&viewfull=1#post482679) seems to be working OK for me.
I end up with master and Dev branches whose git logs contains the expected commits.

Huevos
21-10-19, 19:00
Ok, so you sidestepped it by not doing a "git pull" at all. So only your remote tracking branches are updated, not your local working copy.

birdman
22-10-19, 00:17
Ok, so you sidestepped it by not doing a "git pull" at all. So only your remote tracking branches are updated, not your local working copy.Quite possibly.

My problem was how to keep my github Web (forked) copy and my local file-system copy (which is where all of the work is done) in-step.
This achieves that.
Then I only ever need to push my change-branches onto github, submit a PR and once that is dealt with (either way) I can delete my change-branch in both locations.