Page 13 of 13

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Sat Oct 01, 2016 9:46 am
by adrian_broher
Morlic wrote:
MatGB wrote: All I wanted to do was remove a single commit from my branch.
I use

Code: Select all

rebase -i
for that. Drop the commit and pick everything else...
The general idea is okay and what I would suggest too, but he is using master as working branch.

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Tue Oct 11, 2016 3:41 pm
by Ouaz
I encounter a new problem when trying to edit the FR stringtable with the GitHub web interface.

Usually, here's my process to edit the FR file (way quicker than doing it with Git):

- I enter the "Edit File" page (https://github.com/freeorion/freeorion/ ... les/fr.txt)
- In the textbox, I do a right-click then "Select All"
- Right-click again and I "Paste" my local FR file content
- Commit to master

But since today, when I "Select All", it also selects the line numbers, as a part of the file content!?
edit_file.gif
edit_file.gif (9.4 KiB) Viewed 6006 times
So, when I check the modifications ("Preview Changes"), it says that there are 12986 additions (because obviously of the line numbers selection).

I updated my web browser (FF 49.0.1) but nothing changed.

Do you have the same problem?

Thanks.

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Tue Oct 11, 2016 4:44 pm
by Geoff the Medio
Happening for me as well. At least on a different file... if I try to select all on the huge stringtable page, it hangs firefox until I kill the task.

You can download the file by clicking "Raw", copy-paste it wherever, and then should be able to paste back into the text entry box. Having the line numbers doesn't seem to affect pasting.

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Tue Oct 11, 2016 6:24 pm
by Ouaz
Ok, thanks, it comes from GitHub then.

I found a quick fix though:

# On the "Edit" page (by clicking on the Pencil icon):

- Place the text cursor at the beginning of the file (first line, first character)
- CTRL+SHIFT+END (it will select all the file content -and still the line numbers-, and will place the cursor at the end of the last line)
- DEL on the keyboard
- It will delete everything, and place again the cursor on the first line
- CTRL+V the full file content copied from your local file
- Check the modifications with "Preview Changes"... everything is OK!

And voilà. ^^

Note: weirdly, it doesn't work by using the right-click context menu commands "Select All" then "Delete". It will delete only the first line... ??

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Fri Oct 14, 2016 10:07 pm
by Geoff the Medio
The merge button on the github website has changed... Should I start doing something other than merging with a merge commit?

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Fri Oct 14, 2016 10:36 pm
by Vezzra
Hm, I'd say "rebase and merge" (the new option) should be what we use normally - Marcel?

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Sat Oct 15, 2016 9:36 am
by MatGB
I think it'll depend on the PR—Squash and Merge is good for small(ish) PRs that contain, say, a "typo fix" commit or similar, I use it a lot as most of my reviews are for scripting stuff where a single commit that I've written in main is better.

I'm assuming the bottom rebase option will merge the commits in themselves without a merge message, so they'll each standalone and thus ideally need well written commit messages. And I'm also assuming the top option is merge-as-is, which I've never liked but is better if/when we merge in a fairly big project that has a lot of commits over time, a summary commit at the top explaining the main changes is easier, especially as users of Test releases need to rely on the recent commits list to know what they're meant to be looking for test wise.

So I'd say preference should be for squash and merge or rebase, but occasionally a merge commit would be better.

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Sat Oct 15, 2016 4:37 pm
by LGM-Doyle
Merge and Commit for any PRs with more than one commit.
Rebase and merge for PRs that are already a single commit.

My reasons, are that the other options destroy information that is useful when debugging.

Squash and Merge
Squash and merge destroys context information in the multiple commits of a PR. If squashing the commits would make it easier to follow, then it should have been done in the PR before the merge.

As my current PRs make clear multiple commits make a PR easier to review. It also makes it easier to find and fix bugs after they are merged to master. It easier to find bugs if git-blame leads you to a focused commit where it is obvious what the original dev's intent was and how it is interacting poorly with the current code. Sometimes it is unclear because of subsequent changes in the code that couldn't be anticipated or caught in the original PR review.

Rebase and Merge
Rebase and merge destroys all of the branching information and folds all of the commits back into a linear commit history.
Rebase and merge makes the entire commit history look like old school CVS, giving up all of the post merge benefits of branches. It does not change the dates of the commits, so all commits of the merged branch and all other branches will be mixed in together.

github does not present the branching information prominently (or well), but many other tools do. To see the branching information in git bug click Graphs->Network and you can see where/when a PR was branched and where/when it merged. Again this is useful in debugging, because one PR is probably a series of related changes and seeing them in order allows you to see where things went wrong. Rebase and merge prevents this kind of debugging by destroying all of the branching information.

Rebase and merge is appropriate for small single commit PRs, like the commits that devs directly rebase and push onto master currently. The merge message would not have added any additional useful information to the commit record.,

Create a merge commit
This is the best option.

It keeps all of the branching information. Even if the original commits are over several weeks/months they are collected together. The arc of development is visible using most git tools and in github with Graphs->Network.

Having a merge message ties the whole PR together providing context for all of the changes as a set. We might consider asking contributors to include a merge message in their PR, or just use the initial PR message. Then the message is most like correct and not an additional burden on the merging dev.

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Thu Sep 06, 2018 8:13 pm
by Cjkjvfnby
As my current PRs make clear multiple commits make a PR easier to review. It also makes it easier to find and fix bugs after they are merged to master. It easier to find bugs if git-blame leads you to a focused commit where it is obvious what the original dev's intent was and how it is interacting poorly with the current code. Sometimes it is unclear because of subsequent changes in the code that couldn't be anticipated or caught in the original PR review.
I love squash and merge.

I usually write some code, doing some commits. After that, I test and add fixes. When it works I do self-review, fix some style and other issues.
History is full of commits with wrong intents and I don't think it is useful to see them. Yes, I can play with history and put all fixes to place where they should be, or squash it manually, but I don't want to waste time on it. Different people different coding style.

Squash and merge require one feature one PR. I can see all feature changes from one blame line. (IDEA annotate feature allow to see whole commit changes). I still can find PR for any commit, that was added via PR via GitHub UI interface.

My commit messages are not good. Lots of typos. But I can save some time and edit them in squash and merge interface.

For me, squash and merge is the time saver.

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Mon Dec 24, 2018 8:53 pm
by Cjkjvfnby
New GitHub feature "code owners".

https://blog.github.com/2017-07-06-intr ... wners-work
code owners will automatically be requested for review whenever a pull request touches the files they own.
This might help to solve problems with contributors, who cannot assign PR to anyone.

Re: The Git/GitHub Questions, Answers and Howto Thread

Posted: Tue Dec 25, 2018 8:05 pm
by Dilvish
Cjkjvfnby wrote:
Mon Dec 24, 2018 8:53 pm
This might help to solve problems with contributors, who cannot assign PR to anyone.
Yes, it does sound helpful. If you have time to make an initial CODEOWNERS file that makes you the owner of the ru.rxt stringtable, that sounds good.