I thought the default head branch was now called "main", but today, I noticed in a new repo, the default branch was still called "master". But when I wanted to rename it, the popup told me that I should use main?
My colleagues did see main as default, so I'm wondering, why don't I? Am I using an old version or something?
Although I don't see what repo is this related to, what you experience is most likely seeing your own fork instead of the upstream repository.
If your colleagues see main as the master branch and you see master on your side, check whether you don't have your username as a prefix in the repo URL or title (that'd be your fork) and instead try to navigate into the upstream repository (the one without your username as a prefix).
Unless you use a GitHub desktop client the version will be the same as your colleagues have because it's being served by the GitHub servers for all the users (kind of, ignoring A/B testing, load-balancing, CDN, etc) and only GitHub can change the version.
If you use the desktop client, always try to update first before opening tickets/questions as issues might have already been resolved
Related
I have forked a public Github repo using the Mac GitHub Desktop client, so I can make some changes and submit them.
I have got my fork into a total mess (I am not used to working with forks) and want to start over, but I cannot find a way to tell the client my repo should track the original repo rather than my fork... it seems irrevocably bound to my fork.
How can I get the client app to forget I have a fork?
I'll put up what I found by trial and error, but someone might have a better way:
I basically deleted my repo (form) on Github, and automagically the GitHub client showed my local repo now linked to the original repo again. I was able to go through the process of creating a fork all over again with my changes.
I had 2 repos on Github: "RepoName" and "RepoName_old". I thought I was going to rebuild my project but changed my mind and have been improving "RepoName_old" ever since. I deleted "RepoName".
If I rename "RepoName_old" to "RepoName" (the deleted repository), will something go horribly wrong? The official documentation warns against trying to pull from a branch associated with the old name...I guess that's a different thing...will GitHub Desktop acknowledge the new name after I make the change?
I have terrible experience mismanaging my git repositories and I want to avoid another setback by being informed and careful.
GitHub Desktop is a local tool which should reflect the changes done on GitHub.
On GitHub side, if you have deleted RemoName, you should be able to rename "RepoName_old" to RepoName.
Check first that it works on github.com.
Then try and clone it in command line, and, with GitHub Desktop, add it from your local folder. That should force GitHub Desktop to recognize RepoName with its new origin URL.
Why is eclipse giving me this "No remote URL configured for current branch project" error every 2 minutes? It is triggered when the Yatta application request a project export, I assume.
Triggered by the de.yatta.eclipse.launcher.oomph.tasks plugin:
org.eclipse.team.core.TeamException: No remote URL configured for current branch in repository of project vaadinwebsite.
at org.eclipse.egit.core.GitProjectSetCapability.asReference(GitProjectSetCapability.java:81)
at org.eclipse.egit.core.GitProjectSetCapability.asReference(GitProjectSetCapability.java:53)
at de.yatta.eclipse.launcher.oomph.tasks.impl.ProfilesProjectSetImportTaskImpl.getProjectReference(ProfilesProjectSetImportTaskImpl.java:289)
at de.yatta.eclipse.launcher.oomph.tasks.impl.ProfilesProjectSetImportTaskImpl.getProjectReference(ProfilesProjectSetImportTaskImpl.java:276)
at de.yatta.eclipse.launcher.oomph.setup.internal.builders.ProfilesProjectSetImportTaskBuilder.addProjectReference(ProfilesProjectSetImportTaskBuilder.java:149)
at de.yatta.eclipse.launcher.oomph.setup.internal.builders.ProfilesProjectSetImportTaskBuilder.build(ProfilesProjectSetImportTaskBuilder.java:133)
at de.yatta.eclipse.launcher.oomph.setup.builders.core.SetupBuilder.buildTasks(SetupBuilder.java:290)
at de.yatta.eclipse.launcher.oomph.setup.builders.core.SetupBuilder.buildTasks(SetupBuilder.java:233)
at de.yatta.eclipse.launcher.client.export.ProfileExporter.createProfile(ProfileExporter.java:521)
at de.yatta.eclipse.launcher.client.export.ProfileExporter.exportProfile(ProfileExporter.java:103)
at de.yatta.eclipse.launcher.client.export.ExportJob.run(ExportJob.java:82)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
To the best of my knowledge, there is a remote URL for this project. I mention "eclipse" and "yatta" only to give some context. Considering the comments, it is probably more a "git" setup problem.
Eclipse's error message says "for current branch" (emphasis mine), so presumably it's not willing to take a global repository-wide remote: it wants one specifically for the current branch. If there is only one remote, most likely named origin, presumably this means you should set the current branch's remote setting to origin. If the current branch is zorg that would, on a command line, be git config branch.zorg.remote origin. What commands to use, or clicky boxes to click on, in Eclipse, I cannot say.
This seems like a bug in Eclipse: Git in general will use origin when no remote is configured (e.g., if you run git fetch and the current branch has no configured remote, Git tries to fetch from origin). Since Eclipse is its own thing, it can of course make its own rules, disregarding Git's in little ways like this, or even in major ways.
(Copied from comment to answer, with a bit of editorializing added :-) )
Every time a try to use github I get tangled in a series of errors that seem to have no solution and I give up. This time I thought I'd try to get help.
I have a local repository created and managed with Xcode. All the local git functions in Xcode work with no problem. Now I want to put this project on github so others can see it. I logged into github and created a repository. It's this one:
lummis/CS193P-2015-Assignment-5
I added a .gitignore file but then deleted it again because I thought it was causing an error. I tried adding a readme file but wasn't able to. I got some error that didn't make sense to me so I gave up on that. So at this point the github repository is empty so far as I can tell.
My local repository has many commits and is currently up-to-date. IOW there is nothing to commit. But when I do "Source Code / Push" I get the following error:
Working copy out of date. Try pulling from the remote to get the
latest changes then push again.
So I try to do that in Xcode by doing "Source Control / Pull". But then I get this error:
"github/master" is not a valid remote branch to pull from. Please
choose a different remote branch.
But there is only one branch. There is no other branch (local or remote) to choose. So I'm stuck in a Xcode-github error loop again. I searched for information about this but didn't find anything relevant. I have the Pro Git book and read and understood it at least thru chapter 2. But that doesn't help on interacting with Xcode.
Can anybody say what I need to do? I thought of deleting the remote repository and starting over but apparently there's no way to do that either!
I know lots of people use github so it must work once you know how to use it but it's a big source of frustration for me.
You have a local repository with "many commits". Let's imagine that we have three:
A---B---C
^
master
Your remote repository on GitHub also contains commits, but they are different ones from what you have locally, e.g.
Y---Z
^
master
At least one of these remote commits was created through the GitHub web interface, which creates a new commit each time you use it.
Because the two repositories contain no common history, Git can't figure out how to handle a push from your local repository to the remote one. It will refuse to accept such a push rather than making any remote commits inaccessible, which is what you usually want.
In this case, commits Y and Z in the remote repository can be discarded. They simply add and then remove a .gitignore file, and you want the remote to reflect what you have locally. The solution is to force push.
Force pushing should generally be avoided, since it can cause commits to be discarded (like Y and Z will be in this case) or to have their hashes changed, which causes major problems with shared repositories. In this instance I don't see any danger in force pushing, which can be accomplished with the -f or --force argument to git push.
(There's nothing fundamentally wrong with force pushing, and in some situations it makes perfect sense, but it should be done with care for the reasons listed above.)
I'd like to manage the GitHub wiki for my project at the same time as I'm developing the code. For example:
Branches
master (stable versions)
develop (development of next version)
Others... (Possible other dev / feature branches)
Ideally, I'd like the wiki to be contained in a subfolder (e.g. /wiki) of the project. Then when I'm making changes to the code I can also update the wiki as the same time (code + documentation change). It'd also mean that all my development code and documentation would be self-contained in the "develop" branch until I merge with the "master" branch. Hopefully, even if via a manual process, the GitHub wiki would then be updated after the merge with master to reflect the changes.
I've taken a look at Git's submodule feature, but from what I understand that usually points at a single revision. I'd like to somehow follow my code development so branching and merging would work as normal.
As explained in "True nature of submodules", you can make modifications and updates within a submodule, as long as you commit also the parent repo in order to record the new state of your "wiki" sub-repo.
If you intend to use Gollum to display and work on your GitHub wiki while it's on your local machine (you probably should), then you will have a trouble if you use submodules.
Gollum wants to do local commits to your local Git repository (but not pushes), but in a submodule .git is actually a file containing the local repository, not a true Git repository. This causes Gollum to break.
Submodules also have the problems that the versions aren't coupled to the parent repository, and they aren't completely de-coupled. It a nuisance to have the source code repository to want to push the new wiki version number (but not the wiki contents) every time you make a documentation change.
The solution I use is simply to clone the wiki repository into a directory inside the main project directory and add it to .gitignore. By using a consistent name for the directory across projects (e.g. github-wiki), the chance is minimized that the wiki won't be in .gitignore and gets accidentally uploaded into the main repository.
For consistency, his approach also works well for GitHub pages, although it's unnecessary as they don't experience the problem with Gollum.