Questions tagged [git]
For code which accesses or manipulates a Git repository
129 questions
2
votes
2
answers
115
views
Using git autobackup with shell script
I have php website for prevent hacker modify any file and inject backdoor.
I want to use git as a file tracking solution. This is my shell script:
...
2
votes
1
answer
82
views
Python SQLAlchemy database model for Version Control system
This is my first time creating a non-trivial database and I was wondering what I could do better. As the title says this will be used a in toy version control system. Most of my choices feel "...
5
votes
2
answers
2k
views
How to reduce the build time of Docker image layer in GitHub Actions?
I have a Dockerfile with ubuntu:22.04 as a base image and a manual Python installation(specific version i.e., 3.11.1) layer which takes a long time.
Approach 1:
...
6
votes
1
answer
67
views
TestAssignment class that checks for certain Git repository conditions
TestAssignment is a Python class designed to check certain conditions in a Git repository. It has several methods that check for the existence of required files, ...
12
votes
4
answers
2k
views
Git Push Bash script
I created this bash script to make it easy to publish your files to a GitHub repository.
...
2
votes
1
answer
181
views
std::unique_ptr adapter class template for libgit2 objects
I'm working on a personal project to build an open-source gui for git. I'm hoping to learn a lot from the project, and maybe produce something useful for folks as I do.
I'm making use of libgit2 to ...
-2
votes
1
answer
158
views
Write portable Git aliases
The following aliases return all the same number of results, on my Cygwin (on Windows):
...
0
votes
1
answer
132
views
Best practices python repository. Import it as pip install [closed]
I have this public repository.
Since it's the first repository I have created, I'm looking for tips on what should I improve (mainly in the GH project structure), although tips in the code would be ...
3
votes
1
answer
94
views
Fast git change sets with git wrapping scripts
After having a good experience with virtualenvwrapper built on top of the venv, I thought maybe it could be benefitial to have similar shortcuts for standard activities with git which could be time ...
2
votes
1
answer
76
views
Initialize a gitlab project both locally and remotely with a single command
This shell script, with only a few configurations, has the goal of initializing a project on Gitlab.com without having to go through the go through the website's ui.
This means: Let's say you just a ...
9
votes
1
answer
726
views
git-user - Working on a shared local repository with multiple users made easier
I have recently been in a situation where multiple developers worked on a shared local git repository under the same Linux user¹. As one can imagine, it can easily become a bit annoying not to commit ...
3
votes
1
answer
103
views
Tracking 1400+ client codes, multi-threading nightmare
I am looking for a bit of help. I am having to cycle through 1400 clients code on my server, I have to check what Version of the software they are on and check for customization's to the code so when ...
1
vote
1
answer
97
views
Updated bash/zsh function that cd to the root of git tree
here's the updated version of the code for being reviewed. Fixes:
"private" _cg function
functions definition as ...
4
votes
1
answer
317
views
Bash/zsh function that cd to the root of git tree
I'd like to get a review for the function that cd into the git tree root or does nothing if we are outside of the repository.
reviewed version:
...
5
votes
2
answers
135
views
Pushing local repository to remote repository using python Github
The code should do the following in order:
It should download/clone the public Github repository locally.
It should remove all the git history (and branches)
Use the Github API to create a new Github ...
2
votes
1
answer
85
views
Git commit logger for daily stand-up meeting
At work, my team hosts a daily standup, in which we discuss what we're working on, what we did the day before and any potential blockers for future development.
I thought as a fun little side project ...
3
votes
1
answer
72
views
(Improved) get-release npm module
Improved version of the original question
I've created a simple npm module and CLI program to get the latest GitHub and Bitbucket release from their APIs using Node.js. Please tell me if there's ...
9
votes
1
answer
92
views
get-release npm module
Solved, question with improved code
I've created a simple npm module and CLI program to get the latest GitHub and Bitbucket release from their APIs using Node.js. Please tell me if there's anything to ...
3
votes
1
answer
87
views
How to manipulate directories using Python
I'm using the following lump of code to manage a 9.4gb dataset. I had to divide the dataset into multiple github repositories to be able to do this. I've explained what each block of code does.
<...
2
votes
0
answers
370
views
application to get git commit and write data into csv file
I am writing a small application to get commits between two tags from different env (apple, banana) and write the result into a csv file.
For security, I have to replace some sensitive information ...
8
votes
2
answers
278
views
Fix last n commits to previous commit automatically
I often find myself doing rebase manually in an interactive form in a way as follows. Say I want to squash two last commit to third commit.
First I execute:
...
8
votes
1
answer
125
views
Incremental, encrypted backups for git
I would appreciate any review of the following script I recently posted on GitHub (gitcrypto). Most notably, I would be interested in a review of the cryptographic aspects (I am not an expert in this ...
6
votes
1
answer
231
views
Pre-commit hook to prevent large file commits
I've written the below bash script to run as a pre-commit hook. The intention is to check the git staging area for any files larger than 1mb, and prevent the commit if any are present.
...
8
votes
1
answer
928
views
A Python script that generates git commits for the last year
I implemented a Python script that generates git commits for the last year making one's Contribution Graph look full of changes. It was my first Python program (I work mostly with Java). Although the ...
9
votes
2
answers
346
views
Display git commit statistics in bash
I have scripts to display commit statistics and merge statistics of my repos, and they work. I wrote them for my personal usage, and because I was interested in finding trends in my git repos.
This ...
3
votes
2
answers
132
views
git Create Tree from Arbitrary Directory (works in bare repository)
I made a script for a project I'm working on to create a tree object from a filesystem directory, without any working tree operations (can be run in a bare repository). The tree can be inserted into (...
3
votes
1
answer
96
views
Syncing GitHub repositories local, remote and forks
It's a simple bash script but I'm hoping for feedback, advice and examples on how to improve the script and code. Can you guide me how to put more checks in the code and more if possible?
This code:
...
4
votes
2
answers
1k
views
automating to push changes to github for multiple repos using python
This Python script does following activities:
clone repo, as provided from the list
creating a new branch "jenkinsMigrate"
rename Jenkinsfile to Jenkinsfile.migrate
push code to GitHub in a new ...
4
votes
1
answer
502
views
Download a Git repo without .git folder
Coming from Python, JavaScript and PHP, I'd like to learn to write Ruby in the way it's "supposed to". Well-written Python code is called "Pythonic", so I'd like to know how idiomatic my Ruby code is.
...
3
votes
2
answers
410
views
bash wrapper around 'git commit' to automatically bump (Python) package CalVer and create matching CalVer tag on new commit
I'm doing a lot of Python development lately for various (small-)data analysis pipelines at work. I've been wrestling with how to robustly and ~automatically version the code at a fine-grained level, ...
4
votes
2
answers
357
views
GitHub repo tree generator
I have built a generator that, using the GitHub API, creates a dictionary containing a tree of all the resources in any GitHub repo. It uses the function git_tree, ...
3
votes
1
answer
707
views
Partial Maven clean install after Git pull
I had searched for a solution to mvn clean install on my changed projects after a git pull. I even asked a question over at SO ...
10
votes
1
answer
122
views
Measure size of repository as a function of time
In order to avoid having to make any real progress (at least for a short time), I wrote a script that measures how much progress I have made so far, instead. Specifically, this script sums up the file ...
5
votes
1
answer
919
views
Git hook to detect existing tag case insensitive
In my company, we use git as VCS, the main server run under linux but all our code is for Windows and we all develop on Windows.
The git tag system is case sensitive on linux but is case insensitive ...
8
votes
1
answer
180
views
Perl script to import flat-file versioned files into Git repositories
I wrote a Perl script to import local files with "File-Ending-Versioning" (like file.1.12.pm) into a Git repository. I tried to use the concept of roles ...
11
votes
1
answer
275
views
Counting times a file was committed to Git
A long time ago I implemented some code to walk the git commit graph. I recently updated the accompanying analytics part of the code base to follow file moves/renames in order to get a more accurate ...
2
votes
1
answer
267
views
Commit the working directory to different branch and switch back
The aim of this script is to snapshot the current working directory of a git repository to another branch. Afterwards, it switches back to the original branch and restores the original state, ...
2
votes
2
answers
210
views
Kotlin program to summarize git commits by regex match
I am trying to learn Kotlin. I am coming from some background in Java. As a learning exercise, I wrote this simple program to summarize occurrences of a string by author email in a list of git ...
0
votes
1
answer
388
views
Git hook written on JavaScript
As in many teams, me and my coworkers are putting ticket number into beginning of each commit message. If your branches are starting with ticket number it is easy to create ...
1
vote
0
answers
342
views
Ansible scanning Github branches
While setting up my Jenkins instance with Ansible to connect to our local GitHub Enterprise instance, I need to recreate what the Github Branch Plugin does to scan an Organizations projects and pre-...
5
votes
1
answer
2k
views
Create release package from git tag with Powershell
In my deployment I need to generate a zip file from a git repo. I have the basic work done with how to pull the latest tag and create the zip file. I ended wanting to update the files that are pulled ...
13
votes
5
answers
3k
views
Git delete all merged in local branches
I have written a shell script utility for deleting all merged local branches.
...
3
votes
1
answer
1k
views
Reset files in Git which show as modified but have no changes according to “git diff”
This seems to be working but also is quite horrendously slow and seems a little hacky to me.
...
1
vote
1
answer
89
views
Git Autoupdater
At my office we have an internal monitoring tool we use on customer systems to monitor various vitals and notify us via Slack. Our Lead Dev and Chief Architect are very paranoid about Git, and ...
8
votes
1
answer
2k
views
Tool to calculate the average time that takes for a GitHub pull request to get merged
I'm learning Go, and this is my first attempt at a command-line tool that uses the GitHub API to calculate the average time that takes for a pull request to get merged for a particular organisation or ...
3
votes
2
answers
80
views
Safely pruning merged topic branches locally
Background
My team develops in a git monorepo. User stories are broken into very small discrete sub-tasks and merged directly into master, rather than into a ...
1
vote
2
answers
114
views
Ensure that a directory reflects a specified Git commit
I have a method that looks like the method below, and I can't help but shake the feeling that it can be improved. It doesn't really "read" well, and it seems like ...
4
votes
1
answer
108
views
Daily Add/Del Git Log Analysis
I just finished writing this Python script to calculate daily additions and subtractions from my git log to use in making pretty graphs. This is a rewrite of something I wrote previously in Perl. I ...
3
votes
0
answers
261
views
Colorized zsh prompt with support for Virtualenv and Git
I took the agnoster theme and re-wrote it to this:
...
6
votes
0
answers
134
views
Showing a Wikipedia article's changes as Git commits
I created a small-ish NodeJS script which takes as argument the name of a Wikipedia article (and optionally a Wikipedia edition, "en" is default) and creates a Git repository with each ...