piernas Posted March 24, 2016 Posted March 24, 2016 I'm new to github. Forked the responsive oscommerce build and started doing things. But when the main repository changes and I update my master fork, I always get a message saying This branch is 1 commit ahead of gburton:master. Even when It's up-to date and I didn't change anything. When I see the latest commits the last one is named Merge remote-tracking branch 'refs/remotes/gburton/master'. It contains the latest changes to my repository from the main one. That's fine. But when I make some changes and try to create a pull request to the main repository with changes I've made, that commit is included even when it doesn't contain any files. Why???????? If I go to a 'sub-branch', update it and open a pull request it add the commit mentioned with changed files. Weird or not?? I managed to get rid of this message a couple of days ago, after hours of reading. Pushed something ok. But today the main repo has been updated again and after fighting with git command line the only thing I did is getting five more commits instead of just one, so I now have a nice This branch is 6 commits ahead of gburton:master!!!!!!!!!!!!!!! even when it's updated. Is there any way of avoiding this? I mean ressteing the main branch... Damn github... Isn't it supposed to help? :(
Dan Cole Posted March 24, 2016 Posted March 24, 2016 @@piernas I don't know if it will help or not but you might want to try using something like SourceTree to manage your connections with GitHub... https://www.atlassian.com/software/sourcetree/overview/ Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here.
piernas Posted March 24, 2016 Author Posted March 24, 2016 @@Dan Cole I'm using github desktop but it's very basic and most things must be done in the commandline. Will try sourcetree.Anyway a "reset branch to source repository" command must exist, but I couldn't find it... yet.
♥bruyndoncx Posted March 24, 2016 Posted March 24, 2016 git rebase perhaps what you are looking for ? I'm no expert, so read a little about this first to make sure ... KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
piernas Posted March 24, 2016 Author Posted March 24, 2016 @@bruyndoncx tried rebase and other commands. I ended up with 8 commits ahead, with no file changes. git status tells me "Your branch is up-to-date with 'origin/master'... So then why it's 8 commits ahead? I don't catch the concept. My branch will be always several commits ahead origin/master because it adds a commit every time I update with the master changes. Is it the normal behavior? Its really confusing. :(
tgely Posted March 24, 2016 Posted March 24, 2016 Yes and finaly you should push the new commits into your github repo. Here is a great instruction: http://www.oscommerce.com/forums/topic/397703-github-development-workflow/ osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.
♥altoid Posted March 24, 2016 Posted March 24, 2016 @@piernas In Github my branch shows this: This branch is 36 commits ahead of gburton:master. I believe that is because every time I do a merge pull request to keep my fork up with the Gary's primary repo, I makes a commit to my fork. That's how I understand it anyway, Regarding @@Dan Cole suggestion using Sourcetree. Do that. It's well worth the time. I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are.
piernas Posted March 24, 2016 Author Posted March 24, 2016 @@altoid I'll give it a try. It's good seeing I'm not the only one with that issue. But it seems odd to have empty commits with merge pull requests when you push something into the main branch. @@Gergely Thanks for the link.
piernas Posted March 30, 2016 Author Posted March 30, 2016 Finally solved!!! Thanks to @@BrockleyJohn, you are the man! The sollution is here: http://stackoverflow.com/questions/29049650/github-fork-your-branch-is-5-commits-ahead-how-to-clean-this-without-pushing git checkout mastergit checkout -b mybranchgit remote add upstream /url/original/repogit fetch upstream# reset master to upstream/mastergit checkout mastergit reset --hard upstream/mastergit push --force y--y--y (mybranch) /z--z--z (master, upstream/master, origin/master)# replay the patches (even they are rejected for now) on top of mastergit checkout mybranchgit rebase mastergit push -u origin mybranch Just had a problem with git push -u origin mybranch I had to first do: git push --force Because I had a rejected message with the previous commmand. Now my repository does not show those ugly pull request (w00t)
piernas Posted March 30, 2016 Author Posted March 30, 2016 Another useful tip: To squash i.e. four commits into one, do the following: $ git rebase -i HEAD~4$ gut push -f Magic :-D
BrockleyJohn Posted March 30, 2016 Posted March 30, 2016 I'm glad that helped. To save others digging through all that, the important bit is # reset master to upstream/master git checkout master git reset --hard upstream/master git push --force If your local repo has a remote for Gary's called something different than upstream, then it needs a different name above. You can check remotes with git remote -v All the rest is only needed if you accidentally committed some development into your master branch and you want to save it to a development branch instead of just trashing it. Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x
Recommended Posts
Archived
This topic is now archived and is closed to further replies.