/r/git
From its website:
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is not the same as GitHub. GitHub did not create Git. For GitHub-specific posts, please see /r/github.
Git is not an acronym or initialism: please write git
or Git, but not GIT.
Documentation
Graphical Clients
Code Hosting
/r/git
i'm trying to write a short script crawler through our repos and print out all of the names of demos in an internal git ...the idea is to output the individual repo/project names, last merge/checkin/touch date and the readme.
I have a basic script that works for a single repo (that I have the ID for). I have a first pass that looks like it should work for our entire system but it fails...
Any suggestions?
Edit:
Forgot to include the script...
def getProjectNames():
import gitlab
gl = gitlab.Gitlab('https://our.git.com/', private_token='mytoken')
gl.auth()
all_repos = gl.repos.list(user=organization).all()
return(all_repos)
# projects = gl.projects.list(visibility='internal')
# for project in projects:
# print(project.name)
# projectMembers = project.members.list()
# # commits = project.commits.list()
# # print(commits)
# for member in projectMembers:
# print(member.name)
If you've ever worked on a GitHub project with a large team, you know how quickly branches can pile up. After months of development, dozens (or even hundreds) of branches sit around. With time, knowing what's active, abandoned, and still needed becomes a challenge. That's where Repo Pruner comes in.
Repo Pruner is a GitHub Action that helps solve this issue — keeping repos clean and manageable, even when teams grow and activity ramps up.
It automatically detects inactive branches, summarizes them as a list, and opens a GitHub issue for your team to review.
Learn more: https://github.com/marketplace/actions/repo-pruner
This is a bit of an embarrassing question because i feel like i should already know this. I have two feature branches that is un-merged into `master` branch like so:
featureA-|
featureB-|
|-master
However, the new feature branch i need to work on is dependent on the new features introduced in featureA
and featureB
branches. If i only had a dependency on only one branch, i could build myFeature
off of either one. But in this situation, i need to build myFeature
off of both. What is the correct way to do this in git?
Trying to set up an alias as such:git config --global alias.begin '!git checkout main && git pull && git checkout -b $1'
When I execute git begin test-branch, I am getting this error for the "checkout -b..." part:
fatal: 'test-branch' is not a commit and a branch 'test-branch' cannot be created from it
This works if I do git checkout -b test-branch
so I'm confused that the issue is.
Hi,
I would like to build a little tool to automate a task within a git repository and would like to store some data specific to the git repository in question. For that purpose I would like to store the data within the .git directory of the repository. There are multiple git repositories though, so storing the data in the home directory of the user is out of question. I don't want the data to be moved with the repository directly itself either, when the repository is pushed to a remote end through a `git push` operation, thus storing the data as an object in git itself is out of question too. So my conclusion is that the best way to store the data is in a file that is not managed with git but still is stored within the .git directory, but where within the .git directory of the repository would be the best place to store that data and avoid collision with git or other tools?
I need urgent help with git/gitlab, I have a deadline due in a couple of hours and for some reason I am unable to pull develop branch from remote GitLab to my local Git repo. It get's stuck here (btw this is the furthes it got, it usually stops before Recieving objects
line). Tried using powershell, git bash, wsl and nothing works, always the same error. Even tried to increase buffer size but it aint working.
remote: Enumerating objects: 1121, done.
remote: Counting objects: 100% (1115/1115), done.
remote: Compressing objects: 100% (164/164), done.
Receiving objects: 9% (97/1071)
I had this error yesterday too but it somehow got resolved when I tried pulling main first.
SOLVED: Made a fresh clone using HTTPS. But still don't have any idea why it wasn't working in the first place.
I was recently tasked with creating some resources for students new to computational research, and part of that included some material on version control in general and git in particular. On the one hand: there are a thousand tutorials covering this material already, so there’s nothing I’ve written which is particularly original. On the other hand: when you tell someone to just go read the git pro book they usually don’t (even though we all know it is fantastic!).
So, I tried to write some tutorial material aimed at people that (a) want to be able to hit the ground running and use git from the command line right away, but also (b) wanted the right mental model of what’s happening under the hood (so that they’d be prepared to eventually learn all of the details). With that in mind, I wrote up some introductory material, a page with a practical introduction to the basic commands, and a page on how git stores a repository.
I thought I’d post it here in case anyone finds it helpful. I’d also be more than happy to get feedback on these guides from the experts here!
As per title. Am on windows. `ssh-add -l` never works even though I can SSH in to my repos.
This is the output in CMD:
D:\\temp\\output>eval $(ssh-agent)
'eval' is not recognized as an internal or external command,
operable program or batch file.
D:\\temp\\output>start-ssh-agent.cmd
Found ssh-agent at 18320
Found ssh-agent socket at /tmp/ssh-numbersID/agent.1519
Identity added: /c/Users/.../.ssh/id\_ed25519 (...@gmail.com)
D:\\temp\\output>ssh -T [git@github.com](mailto:git@github.com)
Hi MyAccount! You've successfully authenticated, but GitHub does not provide shell access.
D:\\temp\\output>echo %SSH\_AUTH\_SOCK%
/tmp/ssh-numbersID/agent.1519
D:\\temp\\output>echo %SSH\_AGENT\_PID%
18320
D:\\temp\\output>ssh-add -l
Error connecting to agent: No such file or directory
This is the output in git bash:
ME@DESKTOP-733TH62 MINGW64 \~
$ eval $(ssh-agent -s)
Agent pid 1594
ME@DESKTOP-733TH62 MINGW64 \~
$ ssh-add -l
The agent has no identities.
What's going wrong? How to resolve this?
I have two projects: one on GitHub and one on Overleaf.
Whenever I try to access any of them from a command line by a git command, I am asked for a username and password (in fact, a token). How can I make git to remember these login credentials for each of the projects?
Can someone who is experienced in gitbash please help me!!
I'm working on a project where I want to get the commit history of over 2000 files in a huge mono repository. I'm using the git api and the only 2 parameters im passing to it is the paths (the path of my file) and first_parent. Each api call takes ~25 seconds. Is there a way to optimize this to get it to run faster? Ideally, I want to get the whole commit history. But, if that isn't possible to do really fast, than I can only get the oldest commit of each file. Thank you!
Although it sounds like a dumb question let me explain. So I use ssh cloning for various projects as its easier and some organizations have a weird git instance where http doesnt work. Anyways in my workflow I often switch between windows and wsl and to make my life easier I switched the ssh command on wsl to use the same one(windows openssh) as windows that way it saves my ssh key and its password even after a reboot. The main issue im running into is that locally on my wsl side if i try to do any remote command on either an unknown host or if my know_hosts file on windows was wiped git on wsl hangs indefinitely. One work around I have for this is using git.exe( git for windows) which clones everything as it normally does. I'm trying to modify my .bashrc to check if either git hangs or if it does not know the current host it should use git for windows instead for a remote command only as local commands have no issue. If anyone has any better ideas I'd really appreciate it but for now it seems like checking for remote commands then checking if we know the host or not seems to be the way. Currently I'm checking if the current git command is one of clone | fetch | pull | push | remote | submodule | ls-remote.
Do you use any special plugins?
How do you avoid getting confused about which variant of the file you are editing?
How do you share non-git files like .env files with your worktrees?
Here is the page from Pro Git. The relevant section is “Snapshots, not differences”: https://git-scm.com/book/en/v2/Getting-Started-What-is-Git%3F.
It seems to lump CVS and SVN together and imply that they both track content on a per file basis, rather than as snapshots. But this is clearly not the case for SVN. From the SVN manual:
In CVS, revision numbers are per file. This is because CVS stores its data in RCS files; each file has a corresponding RCS file in the repository, and the repository is roughly laid out according to the structure of your project tree.
In Subversion, the repository looks like a single filesystem. Each commit results in an entirely new filesystem tree; in essence, the repository is an array of trees. Each of these trees is labeled with a single revision number. When someone talks about “revision 54”, he's talking about a particular tree (and indirectly, the way the filesystem looked after the 54th commit).
It seems to me that the book is lumping together two distinct concepts:
Based on my understanding, CVS records changes on a per file basis and stores diffs.
Git records changes as snapshots and does not use diffs (ignoring packfiles).
SVN records changes as snapshots and does use diffs.
In other words, whether a VCS uses diffs has nothing to do with whether it models history as a series of snapshots. SVN is an example of a VCS that does both.
Hello!
I am trying to figure out a branching strategy for a project I am working on and I am a bit lost! There are two environments, prod and test and the project is mostly just different scripts that target remote servers to do some tasks.
My issue is that to even be able to properly test the scripts, a developer must push their changes to Git so it can be deployed to the remote server which has the correct network configuration for them to work. If they push and it does not work properly, they may need to commit more changes to the develop branch.
Once that script is fully tested and ready, it must be deployed to production. Multiple developers may be pushing to the develop branch to test their scripts, which means that the develop branch is never ready for release and there can't really be any code freeze either.
Does anyone have any ideas or tips on what an effective strategy for this could look like? I am looking into trunk-based development but I am not exactly sure if that will work in this case as the code on master could be broken or just for testing
Thanks!
Recently started a new job - i'm on a team of about 6 engs and they work like a well oiled machine. The work is fast paced and in our repo we tend to touch a lot of the same files during the same sprint. An example - in some of my first few tasks, me and another eng are assigned MyFeature that has two parts, where PartA is assigned to the other eng, and PartB is assigned to me, my work depends on the other eng's. I can work independently of the other eng, so we both start by branching from master, but eventually when her first commit goes in I can rebase off PartA branch, and continue my work.
PartA
, it seems the best thing to do is continue rebasing off her latest change - right? (obvi there's the rebase
vs merge
debate, I'm trying to be more comfy using rebase
)PartA
is finally approved and merged back into master
, it would make sense to then rebase
my PartB
to master
, correct?One problem I've been running into - typically, by habit as I commit, I push to remote, in this case it's helpful so I can share my progress easily in the browser with a github link - but after the first one I always run into a ton of merge conflicts... as i type this out i think i know the problem I'm running into - If I'm regularly rebasing my local, making changes, committing and pushing to remote - my updates are compared against the remote, which is rebased from a different commit, could this be why I have to resolve so many merge conflicts locally? Should I just delete my remote branch each time before I commit and push?
I suppose there's no real reason for me to push to the remote until its ready for review... thoughts?
Hi. I'm working on a game with a friend. I'm looking for a git gui program recommendation for a non programmer, to pull the latest versions of the program I'm working on as I push it. Any ideas on something easy and simple for him to use?
EDIT: It seems I didn't explain myself properly enough. I'm personnally happy with my git setup, and know how to use it. What I'm looking for is a gui client for someone else, who is an artist, and won't touch the codebase. All he needs to do is pull the repo , once in a while, of the project we are working on together, to get the updates of the project (and we are using Godot, so he can just run the game from the Godot project without me needing for compiling it).
I've been modifying env by installing some libraries. Git goes crazy, so I tried to .gitignore this folder by adding to just mentioned file:
env/*
also tried: **/env/*
I also tried to do this globally. ~/.gitignore_global pointed out in git config --global.
All files in /env are U (Untracked). What am I doing wrong?
Hello. I have an assignment due for Friday, and I have class the entire day tomorrow, which is why I want to preface this saying I don’t really have the time to look up the answer in the manual. For my assignment, I had to create a branch that I’d use to do the exercises. I did create the branch, but I completely forget to checkout to it until I was done with all of the exercises except one. I did all the exercises on the master (I have an old version of git) branch. I wasn’t supposed to do that.
So I was wondering if there’s any way I can transfer everything I did on the master branch (I did it all in one file) to the branch I was supposed to be in initially ? Please help. Thank you.
I am new with GitHub.
I have cloned an app from there to see how it works in Xcode. The app works perfect.
This is the app
https://github.com/maha0134/biblio?tab=readme-ov-file#biblio---book-search-app-
The problem is that if I download the zip(to practice with it in Xcode)) it doesn't work right... theAsyncImages are not being loaded if I open the project from de zip. Why is that happening?
is it not possible to download the zip to practice with that code in xcode?
Maybe it is a silly question... Sorry but I am new with GitHub
If I clone the app from GitHub I can run it on my device perfectly.
But if I download the zip file to open it in Xcode it doesn’t work right. And if I copy the code in a new proyect to practice with it I have the same problem. The images are not being loaded…
Why it doesn’t work properly if it is exactly the same code???
GitHub apps can be used to try them using the device and to try the code to practice with it as I am trying to do, can’t they?
Just today I learned about git
git add -p
subcommand, and i feel this was missing in my daily flow, so I surely won't forget it anymore
Trying it i get a textual interface asking me, which hunks to add. But at the same time i feel, that I want to use
"meld" for that.
Is there a way I could cofigure meld to offer me the selection ?(like with git difftool)
Thank you for reading
Hi, I recently made a GitHub repo public. I got a mail shortly afterwards from GitGuardian that a password was detected in the repo.
It was a false positive, so I'm not worried about that. The thing is that the repo is for my personal projects, which I login through my personal account. But the mail from GitGuardian was to my company email.
How is that possible?
I initially developed my application with PostgreSQL, but then migrated to MongoDB. I committed before migrating to MongoDB. I added mongodb migration along with several extra features in the same branch (which in hindsight was a mistake, but it happened). Now, I want to switch back to PostgreSQL but still retain the new features I developed while using MongoDB Branch Now, I want to switch back to PostgreSQL, but I still want to retain the new features I developed in the MongoDB branch.
What’s the best way to merge or transfer these new features into my PostgreSQL setup? Should I manually port them over, or is there a more efficient way to integrate the changes?
I have been banging my head against the wall trying to finish GitHub's First Contributions project . Where I keep running into issues is in the "Push changes to GitHub" stage. Learning the difference between HTTPS and SSH was mind numbing enough. So I thought I created a new SSH key, but then the Terminal STILL asks for my GitHub username and pw, and spits out this garbage:
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/mitsk2002/first-contributions.git/'
What am I doing wrong? Does someone have a better tutorial/project? Why are so many Git tutorials so confusing and convoluted?
I am fairly new to GitHub and in desperate need for a fix since I use it for assignments.
I am getting a “The remote disconnected. Check your Internet connection and try again.” error and it will not push anything to GitHub through the GitHub desktop app. I came to the conclusion that it may be due to a large file size? But some of my other projects are able to be pushed with no problem that are also large files, but those ones have been cloned down from GitHub. And I am tech savvy enough to know it is NOT my internet connection.
But I have zero clue how to fix this and my professor hasn’t gotten back to me. It’s been 3 hours and I just can’t figure it out.