Github questions
Github questions
I want extract commits for one certain date, to apply them in the code, i read github help but not found a clue how to do this.
Is it possible?
Is it possible?
-
- Lunatic
- Posts: 380
- Joined: 2015-06-13, 03:34
- Location: KY
Re: Github questions
I don't think it is possible from the Github UI. But you can do it on a local copy of the repository on your computer if you have git installed.
The first thing that would come to mind for me would be something like (use %ad instead of %cd if you want the author date instead of the commit date):
Which would return something like:
This gives you the commits for that particular day (March 16 2017 in that example), if you have cloned the repository and run the commands for your local version. You would need grep for this. There's likely to be a much better way, but it isn't coming up off the top of my head.
-----
Edit:
Decided to look on man pages to see if there was an much easier way.
You could do something similar to the above in a much better way with this (note this is author date, not commit date) and you don't need to have grep:
This will output:
The first thing that would come to mind for me would be something like (use %ad instead of %cd if you want the author date instead of the commit date):
Code: Select all
git log --pretty=format:"%h - %cd" | grep "Mar 16 .* 2017"
Code: Select all
ac8e1ef - Thu Mar 16 19:27:33 2017 -0400
f998c78 - Thu Mar 16 19:24:50 2017 -0400
e8ec8a5 - Thu Mar 16 19:15:52 2017 -0400
-----
Edit:
Decided to look on man pages to see if there was an much easier way.
You could do something similar to the above in a much better way with this (note this is author date, not commit date) and you don't need to have grep:
Code: Select all
git log --since="2017-3-15" --until="2017-3-17" --oneline
Code: Select all
ac8e1ef [Commit message]
f998c78 [Commit message]
e8ec8a5 [Commit message]
-
- Pale Moon guru
- Posts: 35647
- Joined: 2011-08-28, 17:27
- Location: Motala, SE
Re: Github questions
Managing commits in GitHub is very limited. You should probably use a graphical git client like SourceTree for convenience when trying to cherry-pick commits.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
Re: Github questions
Still failed to do what i want
First i do
It produces a file, seems valid.
Then
It also executes normally
And finally
Has bunch of errors
What i do wrong?
First i do
Code: Select all
..\bin\git log --since="2016-12-15" --until="2017-1-10" --patch > p111222
Then
Code: Select all
..\bin\git checkout 27.0_RelBranch
And finally
Code: Select all
..\bin\git apply p111222
-
- Lunatic
- Posts: 380
- Joined: 2015-06-13, 03:34
- Location: KY
Re: Github questions
Try using format-patch:
where C1 is the first commit hash that you want to add, and C2 is the last.
Code: Select all
git format-patch C1..C2
git checkout 27.0_RelBranch
git am *.patch
Re: Github questions
See: viewtopic.php?f=29&t=15014&p=108551#p108551
This explains the basic overview of Pale Moon development.. You should be able to gleam your answer from it. If not.. Someone else can explain.
This explains the basic overview of Pale Moon development.. You should be able to gleam your answer from it. If not.. Someone else can explain.
Re: Github questions
adisib
No way, if c1 c2 commit numbers like c93fb24 , format-patch produses a bunch of files but no c93fb24, git am is something to do with mail and errors about *.patch. Tried different format-patch options, stood for nothing the git manual.
Oh dear how it so obscure. why???
So how to do if only one commit c93fb24?
No way, if c1 c2 commit numbers like c93fb24 , format-patch produses a bunch of files but no c93fb24, git am is something to do with mail and errors about *.patch. Tried different format-patch options, stood for nothing the git manual.
Oh dear how it so obscure. why???
So how to do if only one commit c93fb24?
Re: Github questions
Yes, that is what format-patch is designed to do.Fedor2 wrote:adisib
No way, if c1 c2 commit numbers like c93fb24 , format-patch produses a bunch of files but no c93fb24
git-am is used to apply patches attached to email, e.g. via git-send-email, to the local code base - not patch files.git am is something to do with mail and errors about *.patch.
To apply diffs (as generated by format-patch) to your local code base you'll have to use git-apply.
What adisib was explaining was that you could go two ways.
a) Generate patch files and apply them to your local tree (git-format-patch then git-apply)
b) Output the sha-sums with git-log and then git-cherry-pick them in your local tree.
Re: Github questions
At last I can make git do desired patches.
But i stay very confused anyway. Like all commits are applied according to its list, but it seems is not, where to get its right sequence?
Example
https://github.com/MoonchildProductions ... f61ce3cadd
is located before the
https://github.com/MoonchildProductions ... 01400dc154
which is already applied inside 27.0_Relbranch. And it will errors about it.
But i stay very confused anyway. Like all commits are applied according to its list, but it seems is not, where to get its right sequence?
Example
https://github.com/MoonchildProductions ... f61ce3cadd
is located before the
https://github.com/MoonchildProductions ... 01400dc154
which is already applied inside 27.0_Relbranch. And it will errors about it.
Re: Github questions
@Fedor2:
As Moonchild said, "git cherry-pick" is your best friend here.
Since you haven't provided any details it's hard to be specific, so please tell us which commits, from which branch and where to are you trying to apply them ( onto which branch )!?
For the sake of example, I'll assume here that you want to apply some commit range onto master. If so:
1. First make sure that you localy have the branch you're picking from:
2. Then make sure you're on the master (target) branch:
3. Now cherry-pick:
As Moonchild said, "git cherry-pick" is your best friend here.
Since you haven't provided any details it's hard to be specific, so please tell us which commits, from which branch and where to are you trying to apply them ( onto which branch )!?
For the sake of example, I'll assume here that you want to apply some commit range onto master. If so:
1. First make sure that you localy have the branch you're picking from:
Code: Select all
git pull origin branch_name
Code: Select all
git checkout master
Code: Select all
git cherry-pick C1..C2
Re: Github questions
I'm trying to apply commits after the 27.0_relbranch and before 27.1 on the 27.0_relbranch
I did as [/b]filip suggest, but without pull, i have already all branch, so i decided not do it.
Got
This is even more confusing.
With format-patch method even if i can see which patch failed.
I did as [/b]filip suggest, but without pull, i have already all branch, so i decided not do it.
Code: Select all
git checkout 27.0_relbranch
git cherry-pick 27.0_relbranch..8b3e92a
Code: Select all
error: could not apply 79c8db4... Replace dom::TimeRanges with TimeIntervals object
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
With format-patch method even if i can see which patch failed.
Re: Github questions
Use a GUI for gods sake and cherry pick only the commit you want.. Also, why do you need to cherry pick at all to an old relbranch.. That isn't how the branch structure is.. structured..
Re: Github questions
The matter is not about chery-pick exactly, i was searching any means to make span between 27.0 and 27.1. Because something there breaks one particular site. I think about to apply commits sequentially beginning from 27.0_RelBranch.
-
- Pale Moon guru
- Posts: 35647
- Joined: 2011-08-28, 17:27
- Location: Motala, SE
Re: Github questions
Why don't you just "checkout" the individual commits on the master branch that you want to look at?
that way you don't have to manually apply/pick anything, and you can bisect to quickly home in on the issue.
that way you don't have to manually apply/pick anything, and you can bisect to quickly home in on the issue.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
Re: Github questions
Oh thanks!
This is good idea, but...
Am i wrong, if i delete them? I already have deleted and checkout passed fine, but i worry.
This is good idea, but...
Code: Select all
error: The following untracked working tree files would be overwritten by checkout:
dom/media/platforms/ffmpeg/libav53/include/libavformat/avformat.h
dom/media/platforms/ffmpeg/libav53/include/libavformat/avio.h
dom/media/platforms/ffmpeg/libav53/include/libavformat/version.h
dom/media/platforms/ffmpeg/libav54/include/libavformat/avformat.h
dom/media/platforms/ffmpeg/libav54/include/libavformat/avio.h
dom/media/platforms/ffmpeg/libav54/include/libavformat/version.h
dom/media/platforms/ffmpeg/libav55/include/libavformat/avformat.h
dom/media/platforms/ffmpeg/libav55/include/libavformat/avio.h
dom/media/platforms/ffmpeg/libav55/include/libavformat/version.h
Please move or remove them before you can switch branches.
Aborting
Re: Github questions
If you are in doubt.. Delete the repository completely and re-clone.
Re: Github questions
Another question.
What is the good way to update source code?
1. Download from the github and replace old code
2. Execute git fetch inside existing old code folder
3. Execute git pull inside existing old code folder
4. Delete older folder and execute git clone
What is the good way to update source code?
1. Download from the github and replace old code
2. Execute git fetch inside existing old code folder
3. Execute git pull inside existing old code folder
4. Delete older folder and execute git clone
Re: Github questions
Fetch does not update the code, you need to use pull. But as Tobin has already recommended above you better use GUI. My preferred is SourceTree.
Re: Github questions
So git pull is right, shall do it then. And about gui you suggested - too bad, it wont start in winxp.
I do use git on occasion, gui likely not needed.
I do use git on occasion, gui likely not needed.
-
- Pale Moon guru
- Posts: 35647
- Joined: 2011-08-28, 17:27
- Location: Motala, SE
Re: Github questions
I wouldn't recommend using Win XP as a development environment for anything the size of our code base. Besides, how do you think you are going to compile anything?
There are, by the way, several different GUIs for git available, all of them tons better than trying to do it from the command-line.
There are, by the way, several different GUIs for git available, all of them tons better than trying to do it from the command-line.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite