git checkout -b newbranch lost changes on current branch
So basically, here's what happened with me:
- I was working on a branch, let's call it 'dev'
- I didn't yet stage or commit my changes. However, I needed to test something quick for someone in a new branch.
- So I executed git checkout -b testbranch dev on the command line
- This created a branch called 'testbranch' off of 'dev' and checked out that branch
- However, all the files I had modified in my 'dev' branch (which I didn't stash, stage, and commit prior to executing point 3) got listed in the terminal with a M next to them to indicate modified.
- I worked on the testbranch and once the work was complete, staged and committed my changes and switched back to 'dev' branch.
- Unfortunately, it looks like that all the changes I had made in the dev branch prior to creating/switching the testbranch got lost when I looked at the project in xcode.
So my question is: Is there any way for me to recover the files? Note that my terminal session is still running and I will keep it running until I either get a solution to recover my changes or I find out that those changes are lost forever. HELP!!!!
When I clone a repository from github or any other website and type: git status it checks the current branch for changes against origin remote and shows the message (before making any new commits) : Y
How would you accomplish this? mkdir newbuild cd newbuild git init git remote add origin git+ssh://user@host:22/var/www/vhosts/build $ git checkout -b origin/mybranch fatal: You are on a branch yet to
I have two branches for development and deployment. I made committed some changes to the deployment branch which I wanted to merge into the development branch. Now I expected the merge command to show
I would like to know if these two git commands are the exact same? git clone git://git.yoctoproject.org/poky --branch daisy git clone -b daisy git://git.yoctoproject.org/poky.git
Suppose I am on branch master and I start making some changes. I make the changes to a file which is already opened in Emacs (so under the hood, as checkouts happen, Emacs is unaware unless I revert-
I was working on a branch in my git repo and just messed it up and wanted to just get rid of the changes. So, I didn't commit the changes and checked out my master branch and then did git branch -D b
I have a branch2 who's source is branch1 and renamed a directory originating from branch1. When checking out branch1 the renamed directory remains present but is not marked as an unstaged modification
What is the difference between git branch --track and git checkout -b --track, if there is any?
Git is a phenomenal tool, but I have yet to wrap my mind around the best way to undo pushed changes. Here's the situation. I'm on a branch, and have pushed several commits to GitHub. It has since been
For example, in a git worktree of Linux Kernel. $ git checkout v2.6.6 $ git checkout v3.3 How to find the last head name or HASHID in current branch v3.3? In the example above, it should get v2.6.6 o
It's possible that I'm not really understanding how git works here, but I have a master git branch, and then I created a new branch called refresh. I switched to the refresh branch, made a ton o
I thought I put the days of Xcode + git issues behind me. Guess not. I am getting this git error when trying to checkout another branch. error: The following untracked working tree files would be ove
I was trying to take a look at another branch by a developer and when I did this command: git checkout -b master origin/new_branch_name I got this error message: fatal: Cannot update paths and swit
I have many git repositories. I'm writing script which creates newBranch from master at every repo. So I do this command set for every repo: git checkout master git branch newBranch git push origin ne
I'd like to know what's a good practice of changing the value of an environment variable when doing git checkout <branchname> and give it a value depending on branchname (while having a default
I have forgot to create local branch and was working with remote. After making some changes, i by mistake using Eclipse Git plugin commit this branch in nowhere(obliviously there wasn't local branch).
I'm trying to see what branch I'm on, but its not working... $ git checkout -b test Switched to a new branch 'test' $ git branch $ git branch -a $
Since Xcode at version 4.4.1 doesn't have a switch branch or checkout older version function, is it possible to do that in bash git checkout in-app-purchase-to-be-added or git checkout HEAD^2 beca
I made three commits on Branch A git checkout Branch B git merge --squash A git commit -m B:merge A into B by squash How can I detect branch A has been merged into B by squash?
Our workflow is develop on a local machine, commit the changes to a central repository, then check out the branch of that repository that we need. The problem is that Git changes ownership and even fi
I'm working in a branch (design) and I've made a number of changes but I need to discard them all and reset it to match the repository version. I thought git checkout design would do it, but it just
Alright, lets say one day we make happen to make a bunch of modifications and when we go to commit them we notice we were working on the wrong branch. How can we force git to switch branches without d
The Problem I'm attempting to commit some changes, but they're being left behind, for reasons I do not understand: I take a look a the current repo state: % git status On branch new-master Changes to
This is a simple question that has been bugging me. In XCode 4.2, is there anyway to display the git branch that is currently being edited? I know I can see this from the organizer (or do it from the
Basic question but this happens to me all the time: Make changes in a working-branch Switch to master git merge working-branch git push cap deploy(to staging) make a new cup of tea then I come
Short version What is the easiest way to make a branch equal to master again, discarding any differences? Up until now, I simply used git branch -D wip, followed by git checkout -b wip, but that seems
The other day I was trying to push some changes to the remote server. I kept getting an error so I looked to see what branch I was on. I saw that I was un an undefined branch locally, which was real
On a new repo clone, git filter-branch complains that I have unstaged changes, e.g. $ git filter-branch --subdirectory-filter plugins/hypervisors/hyperv -- --all Cannot rewrite branches: You have uns
I work on local with a remote web server, putting files over ftp. Is there a way that when I checkout a branch, the changed/deleted files will be updated automatically to the ftp deploy server?
According to the documentation on git, a git pull will perform a fetch of the current branch and then run a git merge to merge the changes. After a colleague committed and pushed his changes to the se
Now I have this [root@RUSH pmtsystem]# git branch -a master remotes/origin/upgrade-to-mpdf56 * rush remotes/origin/HEAD -> origin/master remotes/origin/atc remotes/origin/master remotes/origin/pmt
I want to roll my Git branch back to a specific commit. So I run git log and find the commit SHA hash, and run git checkout <myhash>. This usually works just fine, but this time something was f
I was not currently on any branch when I commited my changes. I didn't really notice the message and checked out another branch. How can I retrieve my changes? I can't merge or checkout, since there i
I sort of want the equivilent of cd - for git. If I am in branch master and I checkout foo, I would love to be able to type something like git checkout - to go back to master, and be able to type it a
I'm trying to switch to a branch: git branch new-ui When I do this I get an error that a file would be over written by a merge. This file does not exist anymore. When I do a pull from the current bran
I'm working on a git branch that has a lot of merge conflicts with another branch that I've merged into it. I started fixing the conflicts but want to save my work and switch to another branch before
I just started a new branch, but I deleted there one too many files. How do I reinstate the master and delete the changes in the branch? what is the command? Or is it better to just delete the branch
I actually want to remove a branch in the bare repository i am working with, but this task hits a dead end because I cannot switch away from the master repository without a 'work tree' which a bare re
I am experimenting with branching on git and running into nightmare after nightmare. Anyway, the current issue is that I wanted to merge the master into the branch. I tried git rebase because some s
Some changes were made in git between hash A and hash B (the branch latest is in Z - thousands of commits later). I'd like to have the HEAD (my local one) point to hash A and have in my working direct
I have two branches(Master and Dev). I did some things on the Dev branch, and attempted to merge them with the master branch. git commit -am Dev changes git push git checkout master git merge Dev
basically I want a diff of all changes in a branch that is not merged to master yet I tried: git diff master git diff branch..master git diff branch...master however in each of these cases, it would
I'm writing a script that will take in a specification used as the base for creating a branch. Thus, it will have something like this: git checkout -b $newbranch $startingpoint Now, startingpoint can
I have accidentally forgot to git add . a bunch of files that I have created before creating a new branch using git checkout -b name and all my un-staged files have been replaced by the files from
I am facing a situation where I lost set of changes I made to a few files while working in my branch in git. Unfortunately I realized that I have lost my set of changes a few hours after doing a serie
I was working on master branch, made some changes and then stashed them. Now, my master is at HEAD. But now, I want to retrieve these changes but to a new branch which branches from the HEAD version o
On the current branch, we can run this command: git checkout to obtain a useful message informing us, Your branch is ahead of upstream by N commits. How can an analogous message be obtained for a d
This question already has an answer here: Move existing, uncommited work to a new branch in Git 1 answer I have a bunch of changes in a branch that I didn't commit yet. They ended up getting mo
I have a remote repo on github, and on my local machine I have a few different branches (so I can switch between the branches using git checkout master, git checkout branch2, etc.). When I run the
I switched to a older commit with: git checkout $HASH to look for something i did in an older version of my directory. Now i want to go back to the newest commit, but i cant find the Hash for that any