Save github logs to file - github

Is it possible to save github commits (info about commit, branch, author etc.) to file and create graph with branches as image?
I don't want to make repository public, but I need to share my progress without giving access to repo.

I'm not 100% sure this is what you're looking for, but using the git commands you can do that sort of thing. Clone the repo on your machine, cd to the repo, then you can do something like :
$ git log --graph --decorate --glob="*"
See screenshot below.
If you don't need to do this from a script, you can just copy-paste the terminal output. Otherwise, I'm sure there's a way to place it all into a file.
This graphical output is, IMO, quite useful. I personally use git hist as an alias of the verbose command above.

This is the best solution I found, git log output as HTML file:
https://github.com/bluef/gitgraph.js
Anyway, #Anthony D. provided pretty simple and clean solution.

Related

Importing existing files in repo to new LFS storage (using SourceTree and Git LFS)

TL;DR: What is the least intrusive way of migrating existing files to the LFS storage, once LFS has been initialized on the repository, and a suitable .gitattributes file has been prepared but not yet pushed, for a Unity project using Github, Git LFS and SourceTree?
Software/services used:
Unity 2020 LTS
Github
Git LFS, which is part of Github
SourceTree
Links I'm using:
Githubs own migration tutorial
Githubs documentation for the migrate command
A .gitattributes file, which handles casing-differences in extensions using RegEx (I think).
Another answered question very much like this one.
I also took a look at BFG Repo-cleaner, but it seems a bit much for this task.
Motivation for posting
I've been trying to find a guide describing the best way to do this, but most seem to be out-dated or don't include enough information for me to be confident in firing these import-commands on my repo. Others focus a lot on how to set up LFS using a specific server backbone, like Bitbucket Cloud, but I can't find any focusing on Git LFS and SourceTree.
SourceTree has direct integration with Git LFS, but there seems to be no UI-implementation of the migration process for existing files in the repository, so I think I have to rely on the terminal for this part (which I honestly haven't had to use in years, so there's that).
I also have a question about a command for this that I don't see mentioned in my contexted searches: --fixup
The setup
It's not a huge repo; it's a main branch with a few dead branches that don't matter. I just want all the files with certain extensions converted to LFS. My initial thought was to do the migrate-command with --norewrite, because I liked the idea of compacting all the changes into one commit and have no changes to the commit history, but when I realized that means the files would have to stay in the repo for posterity, I changed my mind. I want the repo to shrink, as well, which means I want to replace the files with pointer-files back through the commit history, in order to eliminate the actual files from the repo completely, so they only exist in the LFS-storage.
My questions and options, as I see them
In that other answered question I linked to, a full answer isn't given, but it's very close. Though the answer is very informative, it doesn't answer these questions:
How to handle case-sensitivity surrounding extensions when writing migrate-commands with --include and --exclude options? Do I need to either go through all existing files in the repo and ensure a similar casing in order to do one-liners, or alternatively fire a separate line for each permutation of the extension I find in the repo? (ignore this question, if --fixup understands the casing-format mentioned in 2. and works for my purposes).
I see that there is a --fixup option for the migrate command, which isn't mentioned in the search results I'm getting with the given context, except in Githubs documentation for the migrate-command. It says:
"Infer --include and --exclude filters on a per-commit basis based on the .gitattributes files in a repository. In practice, this option imports any filepaths which should be tracked by Git LFS according to the repository's .gitattributes file(s), but aren't already pointers."
Is there some reason why the --fixup option isn't recommended anywhere, when it seems to do exactly what I need? Does it not rewrite the history, or something?
I hope it works, because since --fixup reads the .gitattributes files, it should be able to read the different casing-options from the casing-format in the .gitattributes files. Then I don't have to worry about missing files due to different casings, like when using the --include option.
This is the casing-format used in the .gitattributes file (example for .wav files):
*.[Ww][Aa][Vv]
It works for .gitattributes' normal workings, but doesn't work when you use the format for the --include or --exclude options for the migrate-command, e.g.:
git lfs migrate import --include="*.[Ww][Aa][Vv]"
...does not work. This is what gives the casing-issue mentioned in 1.
I have LFS initialized. I have my .gitattributes file (uncommitted) at the root of the project. So, committing and pushing .gitattributes, and then doing 2. seems to be what I want, right? I should be able to open the terminal in SourceTree, and put in this line:
git lfs migrate import --fixup
or do I need --everything, in order to affect all branches?:
git lfs migrate import --everything --fixup
Also, if --fixup doesn't work, is it just a bunch of these?:
git lfs migrate import --everything --include="*.WAV"
git lfs migrate import --everything --include="*.wav"
...followed by a:
push --force
or
push --force --full
???
That's about where I'm at. I'm not entirely sure which way to go here, or how each of these commands affect the result. I'd appreciate any input on what would be the best course here. If anything, I've tried to be as informative as I can and include the best sources I've found on the subject, to help anyone else asking the same questions.
EDIT: I found this issue at the Git LFS repository, which describes a caveat with the --fixup option; it takes into account when the existing files were added to the repo, and if they were added before the changes to the .gitattributes-file, then they aren't included. So, it is recommended to either rebase, or use filter-branch or filter-repo, in order to add/change the .gitattributes file at the root commit, so that the --fixup option will register the files. The issue deals with some more caveats, like having to uninstall LFS first, but eventually found that solution. This is all just to avoid having to do separate calls for each extension-casing permutation. I don't want to do any of those suggestions, since some seem to run into trouble with them, and I can't get --fixup to work with info, meaning I can't preview what it'll change, so I'm going with --include calls, and just searching up all the current permutations of the extensions of the existing files, and doing --include calls for those. Please, if you do have any good information on the subject, I (and probably many others) would love to hear some easier solutions to this problem.
Thanks in advance and best regards, Jonas Tingmose.

How to delete a file from GitHub history without using commandline

I need to remove a file from history. I don't have commandline access to GitHub. Kindly help if this can done through UI itself.
You can't delete the file from history, but you can delete it from the repository by following this help article
Alternatively, you could do a cherry-picking using one of the Git GUIs software, then cherry-pick all the commits, except for the one that you wanted to removed, into a new branch. Then, delete the old branch.
TO achieve this, you have to have command line access.
Delete file from history
But Using UI , you could delete the file from the repo (branch)
Ex:
Click the delete button on top right corner and commit.
You don't need command line access to GitHub, only to your own local clone, where you can:
either do a git filter-branch (example here)
or use BFG
Then you git push --force.
But the alternative, if you really don't want to use any command line, even locally... would be to contact GitHub support, asking them to remove the file from your remote repo history.
That is a last resort option though, since you are supposed to be able to do that on your own.

Github version of Perforce's explicit check-out feature

I've recently moved to Github (VS2017's built-in support) from Perforce for some individual projects. There is a feature in Perforce called "make writable" that allowed you to write to a file locally and then only submit it to the server by explicitly checking it out then submitting it.
This was used extensively for any binary files (.exe, etc) that only needed to be pushed very rarely but still needed to be written to.
Unfortunately from my limited experience with Github, it seems that all files are set to writable and are always marked as "changed", even exes. Is there a setting I can make or setup that allows Github to only mark a file as changed explicitly so I can't accidentally push an incomplete, broken, or debug .exe?
Updated answer: So, I forgot, if the file's tracked by Git at any point, then it gets a bit ugly. There are ways around this, but it isn't a single command to do this.
IF you want to do the .gitignore route, you can. But there's an added step (see below for first step). You have to, after each commit you do of the .exe file, run git rm --cached <filename>. This will remove the metadata around the file telling Git to track it. Once you do that, it won't show up anymore in the Changes list in the Visual Studio plugin (if you're on commandline it won't show up in git status). Then to add a file, you do what I mentioned below, which is to do the git add -f <filename>.
If instead, another way to do this, would be to run git update-index --assume-unchanged <filename>. This tells Git to ignore changes to the file. When you want to commit it, first run git update-index --no-assume-unchange <filename> and do your normal git add git commit workflow, then once you've committed it, run again the git update-index --assume-unchanged <filename> bit. It's messy, and honestly, I'd write a custom tool in VS to do this rather than relying on the built-in SCM tool in Visual Studio.
Original answer: Best way to do this (IMO, others will have their own opinion) is to add the files to your .gitignore. Then if/when you really want to commit them, do a git add -f <file> and then commit as normal.
Edit: Note that this is something everyone will have to do to avoid accidentally committing. A way around that is to commit your .gitignore as well so everyone has the same behavior.

GitHub: Search all branches/versions for string?

Is there a way to search all branches/all their versions for some string? Essentially the equivalent of doing ctrl+shift+f to search the entire solution...but for all versions and branches?
Longshot, but figured I would ask. If not, is there at least something for file name? Asking about github.com, but if it's in gitshell, that's cool too.
My dear friends decided to delete some code at some point in a branch that wasn't merged.
While this would be using Git instead of GitHub's web interface, how about something like this?
git log --all --source -S"Some string"
There is also a -G option that does regex instead of -S. The details are there if you do a
man git log
The only negative here is that it assumes you've already cloned the repository.

Shunning a directory with Fossil

Fossil has a shunning mechanism, which I believe may be used to keep certain files from version control.
I have a directory named R, which I wish to control except for a sub-directory inside of it, named library, which I wish to exclude. How can I "shun" the sub-directory?
My usual workflow is something like this:
fossil new ../fossils/R.fsl
fossil open ../fossils/R.fsl
fossil add .
fossil ci -m "a commit"
fossil close R.fsl
The help page is here, but I still couldn't figure it out:
http://www.fossil-scm.org/index.html/doc/trunk/www/shunning.wiki
If I read your question correctly, you're looking for a way to keep specific files out of version control.
In that case, you're probably looking for the ignore-glob setting.
That setting allows you to specify (chunks of) paths that should be left out of the repository.
For example, if you wanted to leave all files in the subdirectory skip, and you also wanted to keep all *.bak files everywhere out of your repo, you could achieve this with the following command:
fossil set ignore-glob "skip/,*.bak"
The fossil set ignore-glob takes a comma-separated list, so this means any file starting with skip/ will be ignored, and all files matching the *.bak glob will be ignored as well.
If you want to test your ignore-glob setting first (it can be a tad tricky to get right, in my experience), you can test it using the extras command. fossil extras will normally show all files present in the working folder (and its subfolders), but are not in the repository. You can override the ignore-glob setting using the --override command-line switch; thereby allowing you to test it. If it works OK, you can save that ignore-glob with the settings command, as described above.
Do NOT use shun for this!
As the documentation clearly says, shunning is not recommended. It should only be used with great care, and only if you understand exactly what it does, because you can seriously fuck up your repository if you use it the wrong way.
Your question makes it clear that you don't understand its use, so I strongly suggest forgetting about shun until you're more familiar with the working of Fossil.
Do not use shunning. Use this:
cd R
fossil settings ignore-glob "library/*"
fossil settings ignore-glob
fossil ls
fossil extra
Here is a good guide for start https://www.fossil-scm.org/xfer/doc/tip/www/quickstart.wiki