Pull request vs Merge request

 Answer recommended by GitLab GitLab’s “merge request” feature is equivalent to GitHub’s “pull request” feature. Both are means of pulling changes from another branch or fork into your branch and merging the changes with your existing code. They are useful tools for code review and change management. An article from GitLab discusses the differences in naming the feature: Merge or pull requests … Read more

fatal: Not a valid object name: ‘master’

When I git init a folder it doesn’t create a master branch This is true, and expected behaviour. Git will not create a master branch until you commit something. When I do git –bare init it creates the files. A non-bare git init will also create the same files, in a hidden .git directory in the root of your project. When I type git branch master it … Read more

master branch and ‘origin/master’ have diverged, how to ‘undiverge’ branches’?

You can review the differences with a: before pulling it (fetch + merge) (see also “How do you get git to always pull from a specific branch?”) When you have a message like: “Your branch and ‘origin/master’ have diverged, # and have 1 and 1 different commit(s) each, respectively.” , check if you need to update origin. If origin is up-to-date, then some commits … Read more

Download a single folder or directory from a GitHub repo

Update Apr. 2021: there are a few tools created by the community that can do this for you: Download Directory (Credits to fregante) It has also been integrated into the excellent Refined Github chrome extension as a button in the Github web UI. GitZip (Credits to Kino – see his answer here) DownGit (Credits to Minhas Kamal – see his answer here) Note: if you’re trying to download a … Read more

.gitignore and “The following untracked working tree files would be overwritten by checkout”

It seems like you want the files ignored but they have already been commited. .gitignore has no effect on files that are already in the repo so they need to be removed with git rm –cached. The –cached will prevent it from having any effect on your working copy and it will just mark as removed the next … Read more

git push says “everything up-to-date” even though I have local changes

Are you working with a detached head by any chance? As in: indicating that your latest commit is not a branch head. Warning: the following does a git reset –hard: make sure to use git stash first if you want to save your currently modified files. As mentioned in the git checkout man page (emphasis mine): It is sometimes useful to be able … Read more