Relative Content

Tag Archive for gitgithub

How to create a .gitignore file with a preset using Git?

Is there a way to generate a .gitignore file using one of the listed presets found here https://github.com/github/gitignore using Git? The --gitignore flag for the gh create repo command using the GitHub CLI is the closest thing to it I’ve found, but AFAIK it does not overwrite an existing .gitignore file.

How to create a .gitignore file with a preset using Git?

Is there a way to generate a .gitignore file using one of the listed presets found here https://github.com/github/gitignore using Git? The --gitignore flag for the gh create repo command using the GitHub CLI is the closest thing to it I’ve found, but AFAIK it does not overwrite an existing .gitignore file.

I haven’t merged my branches to main and now main is way behind. How can I merge all my branches to main?

I’ve been working on a repository for about a year now and have 23 branches. I’m the only one, no one else is working on this repository. I’ve always committed my changes and pushed them up to the remote origin on GitHub. I see that each branch is successively ahead of Main, my latest branch is 23 commits ahead of Main. I found this is a problem when I got a new laptop and cloned the repository and noticed that what I got is way behind where I was on my other laptop. What is the best/easiest way to merge all those branches to Main so when I clone the repository I get the latest?

Is it possible to demote “master” to a sub-branch (with its entire structure) and create a new master?

There is a repository, “X”, that I forked and began doing work on to migrate it to the Jetson Nano. This fork’s “master” has several branches and is a number of commits ahead and behind the original master it was forked from. In order to participate in another project I’ve been invited to contribute to, I need a fresh, pristine, copy of the original repository. The obvious answer is to create a new fork, but that’s not possible here in GitHub without creating an organization, which is more trouble for me than it’s worth.

Squash committing a PR on GitHub with clean commit history

When working with GitHub and the likes, I tend to work on a feature branch, where I frequently commit & push changes; about as frequently as I locally save the files I’m editing. This is quite useful for various reasons, but it does mean that my commits are quite random and writing good commit messages for all of them is a waste of time. After I’m done, I create a PR with a proper commit message and after any potential review, I squash commit the PR to the main branch.

Decrease the amount of pushed git commits

Problem I did a lot of commits in one day, leading to my activity graph being kind of distorted, as in the picture below. I don’t like that other squares are so pale – even if I did 5 commits in a day, the square has the lowest possible saturation. I want to somehow decrease […]

How to exclude file which is rejected on push?

I am trying to push my repo to a remote and it complains about a file that is in a branch from far back. How can I remove the file from revision history, in order to push without being rejected for containing a large file?

How do you skip large files (>100MB) when committing in Git?

Is there an automated way to skip large files (>100 MB) while committing in Git? I always make the mistake of adding large files to my local workspace/repo only to have GitHub reject it (size limit of 100 MiB for individual files) and recommend Git LFS.