How do I save work in a (no branch) in git?
I have a project in git. I checked out an earlier commit, now I'm on an un-named branch. I want to save the work here and go back to the latest branch but still be able to come back. How do I do that, is it stash & pop?
Here is what transpired. I realized that I needed to go back to the state of things several months ago. So I ran
$ git log
and located the commit number, E.G.
Author: user account <firstname.lastname@example.org>
Date: Fri Jun 15 15:00:43 2012 -0700
--> WORKING VERSION <--
At which point I switched to that commit by typing:
$ git checkout 1910e8fdf0b37cd5c7a693572bf89767a2615c7d
I made a few changes. Now I need to jump back to the latest version but I want to preserve the changes that I made in the earlier version. I don't want to merge them; they should be a separate branch. But I'm not on a branch. When I type "git branch" I get this:
$ git branch
* (no branch)
And "git status" shows me this:
$ git status
# Not currently on any branch.
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# modified: sn102
# modified: timIRmisc.asm
# modified: timing.def
So how do I save the state of things, go back to master, and then come back to this current state, without effecting any of the other branches? Is it git stash? But then where do I pop it back again? Or maybe git stash branch? I'm not sure. Thanks.
I used git checkout -b to create a new branch. I think that git branch does the same thing. How do these two commands differ, if they differ at all?
I merged a relatively old branch into master and the outcome of the merge was an unholy mess. For some unknown reason when I ran git merge it automatically took some of the out of date code that had s
I have been using git-svn to work remotely on a spike for a new feature. Now I want to commit my changes to SVN, but on a different SVN branch than the one I first cloned. How do I do that ? The orig
In my current repo I have the following output: $ git branch -a * master remotes/origin/master remotes/public/master I want to delete 'remotes/public/master' from the branch list: $ git branch -d rem
git branch -d is almost always wrong about if a branch has code I haven't merged. Very often I'll have branched foo off of master, done work, and then merged it back into master, but then git branch -
I want to implement branch specific functionality to help me with my git work flow. To do that, I need to save some metadata (not necessarily in one file) regarding the branch, and I'd like to keep it
git filter-branch -f --index-filter 'git rm -r --cached --ignore-unmatch mysql_db' HEAD That's what I'm doing to remove mysql_db and that's fine. But now I have to do it from all my tags. How can I do
I'm able to see my local and remote branches colored differently with the following configuration in my .gitconfig. [color branch] current = bold cyan local = normal remote = bold red In git branch
So I have a few different branches that I work on git. For example right now i'm on branch test1 and I want to be able to do a pull and override my local work with a specific commit ID on branch te
I created a local branch which I want to 'push' upstream. There is a similar question here on Stack Overflow on how to track a newly created remote branch. However, my workflow is slightly different.
For a while, I worked in with Git in this unusual way: git checkout -b feature123 tiny edit, commit, repeat git checkout master git merge --squash feature123 Use output of git log --oneline to popula
I've got a git repository with two branches, master and amazing_new_feature. The latter branch contains the work on, well, an amazing new feature. A colleague and me are both working on the same repos
I'm confused about why my production server seems to think it is ahead of my master branch. I use fabric to deploy, and it runs a git pull on the server from my master branch on github. I make no chan
How can I tell git that while I want to allow git fetch on certain branches that I do not want to allow git push on those branches. In other words, I have some branches which reflect current work
I am using git for 1st time. I had created a branch on git, after creating branch I had not work on that branch, I did work in master. now I want that changes in my branch also so how can I pull these
I know how to create an svn branch w/git. But, can I do that off of a past revision/commit ?
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
In git, supposing I have a branch master and a tag 0.0.1, if I do the following: git checkout 0.0.1 git branch -b random-fix # some changes... git checkout master git merge random-fix The branch from
Similar to this question, how can I make an existing Git branch track a remote SVN branch? I often find that I start work in a local branch that I then need to push to an SVN server. Is this possible?
On branch 'first' I did: git add . git commit -m Finished first changes git checkout master git merge first But I forgot to do: git push To push the changes to github. I then created a new branch
I switched to a branch on my local repo and noticed it gave me message showing x files updated. This surprised me as I didn't know there were any differences on that branch. How do I compare that bran
I would like to do the following in EGit: $ git checkout -b newbranch $ git push -u origin newbranch This gives me a new local branch, pushes it to the upstream server and creates the right tracking
i have a branch in TFS from my main team project. The changes that have been done on the branch, I want those files to be updated in my main Team project. How do i do that?
What happens if I stash changes in a branch and then delete that branch? (1) Do I loose the stashed changes? Example: git stash git checkout other_branch git branch -D previous_branch (2) Also, are
At work we use Git a lot but lately we have been experiencing lots of trouble when we try to do merges between branches. We have two development teams and I am the one who takes care of merging the wo
I'm merging changes from a stable branch back onto the development branch. I want it to be a real merge, by which I mean it should show a merge when I do git --graph --oneline. The catch is, I don't
I set just a simple description for my local branch and now I'd like to see it. How one can see description for a branch set by issuing git branch --edit-description?
I want to check the real diff between remote branch and local branch. How can I do that? Issuing the below command partially works, but it shows the diff of the new changes of my local branch too. git
I don't have permissions to delete a branch. My situation is most easily described with an illustration. Say the master trunk commits are called, M1, M2, ... and the branch commits are called B1, B2 a
I've seen this answer, but I'm unsure of what the answerer meant by using git branch -f .. in order to complete the task. I have three branches, my master branch has a bunch of files that I don't want
I was on the master branch, and I ran git checkout -b ui. Did tons of work over the course of a week, at the end of which I ran: git add . git commit -am 'ui' git checkout master git merge ui git push
I run: git checkout mygithub/master but for some reason, running 'git status' shows not currently on any branch. Running: git checkout master and then git status, says that I'm now on branch mas
It happened somehow that I left the master branch and ended up on the no branch branch. How can I give this branch a meaningful name? In detail: Calling git branch shows * (no branch) master and wha
How can I get list of branches emerging from any branch in git ? Also what is the difference between fetch and pull command in git ?
I used git flow to create two branches with git flow feature start <feature name>. I don't remember whether I finished by Using git flow feature finish on both branches, Merging branch A into b
I started with a piece of code which got split into two small programs each in a different branch. They share a lot of similarities but I'd like to split them into 2 repos so I can work on both at th
I'am using git as scm of choice but have to use a svn-repo. I can create a svn-remote-branch like this: git svn branch the_branch But how can i delete the remote branch?
I am working on a branch in git. When I do git checkout <commit id> (commit id obtained from git log ), it is getting committed to that particular change but branch is changed to <No-branch&
I'm a git newbie, and this is what I currently have: master: A -- B -- C \ \ branch: X -- Y How do I Update commit Y with changes from B and C? Is this simply: git fetch machine master; git merge ma
when I do a git pull origin master from a branch the branch is updated NOT the master. In order to update the master I need to do a git checkout master and then call git pull origin master. Why
I have a git repository with multiple branches. The repository has a makefile which is identical between branches. I'd like to create a bash script that can be run on a regular basis that pulls all br
Well pretty simple. Imagine this scenario: [user@home repo]$ git branch * branch-im-currently-working-on long-branch-name-i-want-to-checkout-without-using-my-mouse long-branch-name-i-dont-want-to-chec
How do I get the hash of the latest commit... when in detached HEAD state without specifying the branch explicitly git rev-parse HEAD and git log -n 1 --format=%H both follow the detached HEAD (ob
While working with git-svn, and a 'typical' svn repo /trunk, /branches/..., /tags/... How do I push a local branch to a new branch inside of /branches ?
We recently moved from SVN to Git, but there's a single legacy branch that I need to bring in to the Git repository. The SVN and Git repositories are the same logical code (i.e. they're both called fo
I have BranchA which is 113 commits ahead of BranchB. But I only want the last 10 or so commits from branchA merged into BranchB.... is tehre a way to do this?
How do I push changes from one branch to another branch after a successful Jenkins build? Suppose I have a branch named beta that I commit to and another named master that I want to contain all co
I've got a project that I'm deploying to heroku. The source code tree includes a bunch of mp3 files (the website will be for a recording project I was heavily involved with). I'd like to put the sour
When I type git branch, I receive a list of branches that appear to be sorted alphabetically instead of being sorted by their creation time. Is there a way to make the output of git branch sorted by d
I am working on a project with a remote team. They created a branch (r_branch) that I can see when I'm in GitHub: master r_branch (and it tells me that it's 6 ahead) When I do git branch -r, here's w