The big git and github Pull Request thread

User avatar
Hybrid Dog
Member
 
Posts: 2636
Joined: Thu Nov 01, 2012 12:46

by Hybrid Dog » Sat May 14, 2016 09:05

l use this way to get the changes of a pull request:

get the patch (just add ".patch" at the end of the PR github url):
$ wget https://patch-diff.githubusercontent.co ... 1056.patch

apply and commit it (in 3 way mode for fixing possibly conflicts):
$ git am -3 *.patch

put the downloaded patch file into the bin because it's not longer used:
$ trash *.patch
 

User avatar
TumeniNodes
Member
 
Posts: 2436
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: The big git and github Pull Request thread

by TumeniNodes » Wed Jan 04, 2017 18:27

edit:
sofar, I had to edit this post, due to the fact that the file links on the original link I posted are now all dead (404)s

I did find this link for a Git Cheat Sheet but may be dated, if you wish to look at it to see if it is still current or out of date and obsolete with changes to git code?
The new link is https://jan-krueger.net/git-cheat-sheet ... ed-edition

and I am also adding a .pdf version of the cheat sheet from the original version I posted a link to before
Attachments
git-cheat-sheet.pdf.zip
(119.52 KiB) Downloaded 17 times
My brain, is AES256 encrypted, even I don't know wth I'm thinking...
 

User avatar
Andrey01
Member
 
Posts: 2061
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

Re: The big git and github Pull Request thread

by Andrey01 » Fri Aug 18, 2017 20:08

How to rename or delete files/folders in GitHub repo?
DL9Eh7xVBw7DXwLAMX1lStE21bSD2XUQ
 

User avatar
TumeniNodes
Member
 
Posts: 2436
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: The big git and github Pull Request thread

by TumeniNodes » Fri Aug 18, 2017 20:22

Andrey01 wrote:How to rename or delete files/folders in GitHub repo?

Just for future reference, when you ask, be sure to make it clear to others that you are only familiar with using the GitHub web interface, and not git as a commandline tool.
This makes it easier to know how best to help you.

* This answer refers to making these changes, using the GitHub web interface.

Before doing anything related to making changes to your repo, you want to create a new branch to perform these changes.
When you open the page to your repo, above your username and avatar you will see a box which says Branch Master, click on this.
A drop down window will appear to show an empty field with blinking cursor, add a name for your new branch here. (for the purpose of this example I will call it changes. you may choose any name you like)
This will switch you over to the newly created branch to perform any changes.
Once finished with all changes you will see an option to compare and pull request, select this option.
Add a comment to your PR

After the PR is set you will be asked to merge. (if you have numerous changes, best to choose squash & merge.
Accept this merge to your master repo and you will see a message that it is safe to delete the changes branch.
Your changes are now merged into your master repo branch and ready to share.

WARNING renaming the repo means you will need to make this change throughout your mod/code.
To rename a repo, select the settings option for the repo you wish to rename.
The next page will show your repo's name in a boxed field. You can rename the entire repo there.

To rename an individual file, when you open that file, select the edit option (the small pencil icon to the right)
As a side note of caution: Sometimes, renaming a file can have an impact on other aspects of your mod/code. Be sure to check all naming associated with this file throughout your code.
The file's name will appear in a boxed field. You can rename the file there, then select commit.
When the page refreshes, you should see your file with the new name.

To delete a file, simply select the delete option (the trash can icon to the right of the edit icon.

Texture files can only be renamed by uploading them to your repo under a different name, and then delete the original one, that you wanted to rename (otherwise you will have 2 of the same textures, with different names)

To delete an entire folder using the GitHub web interface, unfortunately (as far as I know) you need to delete every file within that folder. Once all are deleted, you need to commit.
The refreshed page will show your repo, minus that folder.
There may be other ways using this method, but I do not know of them.

I hope that helps
If there is any part you were looking for which I did not address, let me know.
My brain, is AES256 encrypted, even I don't know wth I'm thinking...
 

User avatar
Andrey01
Member
 
Posts: 2061
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

Re: The big git and github Pull Request thread

by Andrey01 » Sat Aug 19, 2017 12:27

[quote="TumeniNodes"]
Once finished with all changes you will see an option to compare and pull request, select this option.
Add a comment to your PR[/quote="TumeniNodes"]
Do you mean it?
Image
I don`t know how to commit here and what`s a PR?
DL9Eh7xVBw7DXwLAMX1lStE21bSD2XUQ
 

User avatar
Hybrid Dog
Member
 
Posts: 2636
Joined: Thu Nov 01, 2012 12:46

Re: The big git and github Pull Request thread

by Hybrid Dog » Sat Aug 19, 2017 13:11

l like that one: http://marklodato.github.io/visual-git- ... ex-en.html

When doing changes to your own repository, you actually don't need to create another branch. You can simply do the changes in the master branch. l don't know why TumeniNodes doesn't like this.
Anyway, you likely want to use an offline git client instead of performing changes at github.com because it's more convenient (on linux that is)
 

User avatar
TumeniNodes
Member
 
Posts: 2436
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: The big git and github Pull Request thread

by TumeniNodes » Sat Aug 19, 2017 17:35

Using the Master Branch for changes is fine, using a newly created "temporary" branch for changes simply keeps the volume of commits low on a master branch, and is good practice.

The online GitHub web interface is good for those who use this on a basic level, and are unable to understand the complexity of the offline, CLI methods.
It can also be helpful to those learning those methods, who learn more efficiently when they can have a visual example of what does what. Of course there are other gui frontends for those other methods as well.

Andrey, it is difficult to know how you got where you are in that screenshot, without knowing "what" it is you were attempting to do.
It looks as though you were trying to update your fork of another repo, from the main repo?
There is an easy way to do this. And this is how I learned to update my forked repos.
The following was written by another, who's name escapes me right now:

Updating a fork to the master branch on GitHub

GitHub makes it very simple to fork — or create a personal copy of — a public repository. While I could easily star a repository I found interesting (or watch it), I tend to fork instead, thinking, somewhat optimistically, that I’m going to dig in and immediately start contributing.

Updating a fork via the command-line is as easy as running git pull (provided your remote origin url is set correctly). On GitHub.com, it requires a few additional steps:

Log into GitHub and click on the repository you’d like to update. If your fork isn’t current you’ll see a message like this: This branch is 630 commits behind [repository name]:master. And yes, one of my forks was actually over 600 commits behind the master branch.
Click the white/plain colored New Pull Request button.
“There isn’t anything to compare,” GitHub will sniff, more than a little disappointed in your lack of commitment to open source software. This will come as no surprise, as the base fork is set to the master branch and the head fork — where all the changes should be — is your local fork. Find and click the “switching the base” link to reverse them.
“This comparison is big! We’re only showing the most recent 250 commits.” That’ll do, GitHub. Click the green Create Pull Request button.
Enter a title (e.g. “update to current branch”) then click the Create Pull Request button. Review the message at the top to make sure you’re pulling the right way. It should read something like this:

[username] wants to merge 630 commits into [username]:master from [repository name]:master

If so, scroll down past the hundreds of commits made by more dedicated developers than yourself, to the green Merge Pull Request button and click it quickly before the guilt and self-loathing sets in.
GitHub will give you one last opportunity to change your merge message. Click the button (that now reads Commit Merge). Your fork is now current to the master branch!

A "PR", is a pull request.
You either wish another main repo to pull in your changes, and merge them or, you wish to pull changes to a main repo, into your copy of said repo.
You are requesting the changes to be reviewed and considered.
Last edited by TumeniNodes on Mon Aug 21, 2017 13:40, edited 3 times in total.
My brain, is AES256 encrypted, even I don't know wth I'm thinking...
 

User avatar
Wuzzy
Member
 
Posts: 3132
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: The big git and github Pull Request thread

by Wuzzy » Sun Aug 20, 2017 14:11

I think all of this should be copied into dev.minetest.net.
It makes more sense than here, in the forums.
My projects: MineClone 2. Hades Revisited. Help modpack. A ton of other mods, see here.
 

User avatar
TumeniNodes
Member
 
Posts: 2436
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: The big git and github Pull Request thread

by TumeniNodes » Sun Aug 20, 2017 22:39

I think most of us are unreasonably fearful of hammering out documentation :P

I guess a link to such a thread as this would be helpful.
But it may also be a good idea to separate using git as it is intended, as a versioning tool & githib.com web interface usage, for the basic hobbyist.

Some of what I have added in reference to github.com use could probably be cleaned, up and reorganized better to be clearer in layman's terms.
I just naturally suck at explaining and documenting (not a perfect excuse, but It's what I'm going with)
My brain, is AES256 encrypted, even I don't know wth I'm thinking...
 

User avatar
Andrey01
Member
 
Posts: 2061
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

Re: The big git and github Pull Request thread

by Andrey01 » Mon Aug 21, 2017 12:37

TumeniNodes wrote:Using the Master Branch for changes is fine, using a newly created "temporary" branch for changes simply keeps the volume of commits low on a master branch, and is good practice.

The online GitHub web interface is good for those who use this on a basic level, and are unable to understand the complexity of the offline, CLI methods.
It can also be helpful to those learning those methods, who learn more efficiently when they can have a visual example of what does what. Of course there are other gui frontends for those other methods as well.

Andrey, it is difficult to know how you got where you are in that screenshot, without knowing "what" it is you were attempting to do.
It looks as though you were trying to update your fork of another repo, from the main repo?
There is an easy way to do this. And this is how I learned to update my forked repos.
The following was written by another, who's name escapes me right now:

Updating a fork to the master branch on GitHub

GitHub makes it very simple to fork — or create a personal copy of — a public repository. While I could easily star a repository I found interesting (or watch it), I tend to fork instead, thinking, somewhat optimistically, that I’m going to dig in and immediately start contributing.

Updating a fork via the command-line is as easy as running git pull (provided your remote origin url is set correctly). On GitHub.com, it requires a few additional steps:

Log into GitHub and click on the repository you’d like to update. If your fork isn’t current you’ll see a message like this: This branch is 630 commits behind [repository name]:master. And yes, one of my forks was actually over 600 commits behind the master branch.
Click the green New Pull Request button.
“There isn’t anything to compare,” GitHub will sniff, more than a little disappointed in your lack of commitment to open source software. This will come as no surprise, as the base fork is set to the master branch and the head fork — where all the changes should be — is your local fork. Find and click the “switching the base” link to reverse them.
“This comparison is big! We’re only showing the most recent 250 commits.” That’ll do, GitHub. Click the green Create Pull Request button.
Enter a title (e.g. “update to current branch”) then click the Create Pull Request button. Review the message at the top to make sure you’re pulling the right way. It should read something like this:

[username] wants to merge 630 commits into [username]:master from [repository name]:master

If so, scroll down past the hundreds of commits made by more dedicated developers than yourself, to the green Merge Pull Request button and click it quickly before the guilt and self-loathing sets in.
GitHub will give you one last opportunity to change your merge message. Click the button (that now reads Commit Merge). Your fork is now current to the master branch!

A "PR", is a pull request.
You either wish another main repo to pull in your changes, and merge them or, you wish to pull changes to a main repo, into your copy of said repo.
You are requesting the changes to be reviewed and considered.

Aha, i should your explanation. When i clicked "New Pull Request" (this label is not green, it`s white color) that page called as "Compare changes), hmm... i don`t see "switching the base" link. Instead that i see two labels "base:master" and second one "compare:master" --- what do i need to do here? Switch branches? Rename some these branches? Can i rename them so how i want? How i understand these branches must be different. I tried rename "compare:master" label in "changes", then it wrote "We couldn`t figure out how to compare these references, do they point to valid commits?" It means i did not find that link that you told me.
DL9Eh7xVBw7DXwLAMX1lStE21bSD2XUQ
 

User avatar
TumeniNodes
Member
 
Posts: 2436
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: The big git and github Pull Request thread

by TumeniNodes » Mon Aug 21, 2017 13:37

First thing Andrey:
What is it, you are trying to do?
And yes, the info regarding the "green" pull request button is aged. I will edit that bit, as it is indeed white/or plain.

Also note, I really don't want this thread going way off what sofar intended it for, and turning into a mile long, unfollowable gibber.
If I am unable to get you where you wish to be, after the next question, I will figure another way to help you elsewhere.
My brain, is AES256 encrypted, even I don't know wth I'm thinking...
 

User avatar
Andrey01
Member
 
Posts: 2061
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

Re: The big git and github Pull Request thread

by Andrey01 » Mon Aug 21, 2017 15:45

TumeniNodes wrote:First thing Andrey:
What is it, you are trying to do?
And yes, the info regarding the "green" pull request button is aged. I will edit that bit, as it is indeed white/or plain.

Also note, I really don't want this thread going way off what sofar intended it for, and turning into a mile long, unfollowable gibber.
If I am unable to get you where you wish to be, after the next question, I will figure another way to help you elsewhere.

I have become confused in it eventually. Then i will send you a screenshot here for imagination of that i did. Do you know something manual of usage GitHub? Only no the guide that exists in github.com. There are very a little information about it.
DL9Eh7xVBw7DXwLAMX1lStE21bSD2XUQ
 

User avatar
Linuxdirk
Member
 
Posts: 1551
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: The big git and github Pull Request thread

by Linuxdirk » Mon Aug 21, 2017 15:50

TumeniNodes wrote:... and turning into a mile long, unfollowable gibber.

Like the screenshots thread, or the "ask your modding questions here" thread, or the move requests thread, or the TP conversion thread, or ..., or ..., ...

This forum seems to have a thing with unmaintainable gigantic threads :)
 

User avatar
TumeniNodes
Member
 
Posts: 2436
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: The big git and github Pull Request thread

by TumeniNodes » Mon Aug 21, 2017 17:10

Andrey, looking again at your screenshot, it looks as if you are trying to update your fork of another main repo.

In your image, the left box. That is where you want to click on the downward arrow (in that box), and set it to the main repo you made your fork from.
Everything else is fine.

So, if you are trying to pull the recent build of Mbb's trains repo, his repo is the one you want to choose for that left box.

If that does not work, send me a PM, and we will try to set up a time to meet at #minetest, so I can help you in real-time, ok.
My brain, is AES256 encrypted, even I don't know wth I'm thinking...
 

bell07
Member
 
Posts: 516
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: The big git and github Pull Request thread

by bell07 » Thu May 03, 2018 15:51

Great thread! I tried some time again to explain git some time again in a howto, but I given up :-( Git is to powerfull to be exlained with limited words count.

I think the best way to understand git is to understand each step the "clone" command/macro does. Maybe you can add the next info to the

Short:
Code: Select all
git clone http://url/to/repo my_mod
cd my_mod


Long:


Initialize
Code: Select all
mkdir my_mod
cd my_mod
git init


Add an remote working directory called "origin" and assigned to URL
Code: Select all
remote add origin http://url/to/repo

Multiple remotes are allowed. To work together with me you need to add my repo to your remote
git remote add otherrepo http://url/to/other/repo
Tipp: Check connected repos
Code: Select all
git remote -v


Just download/update data from remote into ".git/"
Code: Select all
git fetch origin
# git fetch otherrepo


Create a new local branch. You need to do it once to work on 1 branch
Code: Select all
git checkout -b master origin/master
# git checkout -b otherrepo_master otherrepo/master


Tipp: Any time you can switch between branches and chck the status
Code: Select all
git checkout otherrepo_master
git branch -vvaa


Additional info: done by "git checkout -b" but could be set/changed manually the connection to the remote origin branch
Code: Select all
git branch --set-upstream-to=origin/master
git branch -vvaa
git branch --set-upstream-to=otherrepo/master
git branch -vvaa
 

Previous

Return to General Discussion



Who is online

Users browsing this forum: No registered users and 2 guests