How do I tell bitbucket to show a certain changeset by default? - version-control

I´ve have configured Mercurial together with SourceTree and Bitbucket. I´m able to see all the files in Bitbucket as long as i´m just adding files to the SourceTree repository. However, if i´m changing to another version (using right click and "Update To" in SourceTree), the updates are not pushed to Bitbucket. When I press the Push button in SourceTree, it says "No changes to push". (Even though the version is changed locally on my computer).
Thankful for any help!
Cannot push updates to BitBucket from SourceTre

That's to be expected. When using mercurial, a push by default pushes all public and draft revisions in all branches. Thus locally updating your checked-out working copy will not magically add anything new to push.
As it's a distributed VCS, a push will never change the working dir state of any other repository. Concerning repository browsers and web management systems like bitbucket a similar argument has to be made (as they usually do not have any working dir at all, so-called 'bare repositories'). By default they most likely show the newest changeset or newest changeset to default branch. It can be argued that the commit bookmarked with '#' might make sense as well. However they might offer in their UI to show by default a particular revision or branch, and that includes bitbucket.

Related

Using GitHub Desktop for Windows and Origin on GitHub got confused about the default branch

I'm not certain what happened. Somehow "main" didn't get set as the default branch at the origin. It got set to an old branch that I've long since moved beyond. Though I see in the settings where I can switch the default branch, GitHub presents a big, scary warning that says:
"Changing your default branch can have unintended consequences that can affect new pull requests and clones."
What's the actual danger here? Or is there a way to just recreate the origin repository at GitHub from my local repository? This is just a personal thing that I'm working on. No worries about collaborators.
There is no real issue in your case, for a personal repository.
You can use a gh repo edit --default-branch main (using the GitHub CLI gh, to be installed first), if executed from your local repository folder.

Github overwrote updated files from a previous commit without being able to retrieve the updated files?

I had made some changes to the code and wanted to create a new branch to reflect those changes.
Using the github software on mac, Peak Meme (162), I clicked on branches, clicked the + sign next to master, created a branch called updating-design. I think I clicked publish.
Then I went into PHP storm and all the code from the last few days was deleted.
The code was deleted from my local clone. I was trying to push the changes I had made through the new branch.
You can use the git reflog and retrieve it from the command line
It sounds like you were already working on another branch without realizing it, and now you've checked out a new branch that doesn't have the work. Double-check your list of branches.
Git is pretty adamant about not deleting your work just because you switched branches.

EGit Commit to Remote Branch without Local Branch

I had a branch I was working on for a long time on my desktop. First I commit changes to my desktop's local branch, then push them to the remote branch and everything is dandy.
This morning, I was working on my laptop and selected the remote branch to change. The image below shows what my EGit repository window looked like on my laptop, except there was no local "MethodMigration" branch (there was a local master though). The remote "MethodMigration" branch had the little black check-mark next to it telling me that I'm viewing it as shown in the picture.
https://docs.google.com/file/d/0B7yGmb99B5enZm5OcTcydnEwLUE/edit (Sorry for the ghetto google drive link. I couldn't figure out how to get an image link)
Anyhow, I started adding a whole bunch of stuff. After I was done, I did a "Team->Commit->Commit & Push" after giving it a message. At that point, I remembered that I hadn't made a local branch for it yet... It told me "Nothing to push" even though a whole bunch of stuff had just been specified (which kind of makes sense since I never cloned the remote branch to make a local copy in the first place). The bad part is that all of my code was reverted back to the original "MethodMigration" remote branch code. Additionally, BitBucket shows no commits or anything.
Where did all my changed code go? Is there a way to get it back?
No worries!
You can use git reflog to find the commit id SHA of the lost commit. After that simply merge it with your local branch:
git merge <commit-id>

Github not checking if local repo has changed

I recently re-installed my computer,
and now I'm encountering problems with github for windows (I'll be using GFW in the rest of this text). it say's that my local repo is in sync, but even if I change things, delete files, or add files it keeps saying that it is in sync.
It does check if I make changes on a different computer and push them. but syncing then won't work, so I went to shell
there I can commit (shows in GFW that there are commits ready to be pushed), sync button in GFW still doesn't work (showing that there are problems, and I should continue in git shell). When I commit in shell says that there are changes , insertions, and deletions
Then when I want to push it says Everything up-to-date.
Anyone got any clue what is going wrong?
Check if you are actually on a branch: are your commits made on a branch, or on a "detached HEAD"? (more on this at "cannot push to GitHub: everything up-to-date").
A simple git branch can show you the active branch. If there are none, that would explain why the "sync" button is inactive. You need to fast-forward your branch to that detached HEAD.

Getting started with GitHub and Eclipse (spring source toolsuite 2.7.1)

I am new with both Git and GitHub so please bear with me.
I have an empty repository on GitHub with an automatically created branch (gh-pages), which, I understand, is supposed to be used with GitHub's pages functionality.
Now what I would like to do is to create and eclipse project from which I could commit/push to this repository.
What is confusing me that I can't see any option to create a remote branch on github. I suppose pushing my source to gh-pages won't be a good idea. BTW, I also don't understand why the GitHub pages is feature is implemented as a branch? Aren't branches supposed to be merged with each other at some point. Clearly it wouldn't make any sense to merge github pages into my project. Wouldn't it be better to have a folder within my project for this purpose.
I googled and found this link but being a git noob I am not sure if that's what I want to do. I would like to use Eclipse as my primary interface to git and github only falling back to command line or other interfaces when there is no other option.
OK I think I have figured it out. Basically, what you need is to define a remote ref that need not exist before hand.
Create a project
Team->Share it to a local repository
In the repository view (Window->Show View-> Git -> Repositories) select the local repository and right click on remotes
Select new remote (configure push). Type origin in the remote name. Press OK
Change URL. Copy/paste the ssh uri from github. Select ssh protocol (make sure you have ssh key defined in eclipse SSH preferences, and uploaded to github)
Now the last part is to add Ref mapping. Click on Add.. in ref mapping section of screen. And enter refs/heads/master in both local and remote branches.
Or may be the refs/heads/master on both side isn't a good idea :)
I see, cloning a github repo that doesn't have gh-pages branch is simpler as it automatically creates this remote fetch spec
Remote Fetch Specification +refs/heads/*:refs/remotes/origin/*
Maybe this is what I need to enter in the step 6 above
Ok as it turned out the original idea of "refs/heads/master in both local and remote branch" was correct. Pushing with this configuration is showing my changes in git hub correctly. The second option on the other hand is failing silently.
Branches typically are used in the way you described, but nothing says they must be used that way. This is just the way github chose to let you manage your page content, and it works quite well. It's kind of similar to hosting multiple repos on one SVN server.
As for creating new repos, if you create a repo in github and then clone it, you'll have an empty repo locally that already points to github with a remote named "origin". This is a convenient way to start out, since you don't have to mess with adding a remote yourself. At this point, your repo has no commits and no branches in it. When you make the first commit, it will automatically establish a branch named "master". I don't know how eclipse is set up by default, but from the command line with default settings, you have to explicitly push new branches to a remote or else they won't get pushed at all. I.e. making the first commit and doing git push will just fail with a message like "No refs in common and none specified; doing nothing". Instead, you have to git push origin master to tell it to establish the "master" branch in remote "origin" (aka github). Thereafter, just a git push will work fine.
Hope that clears up some of your confusion.