{"action":"created","issue":{"url":"https://api.github.com/repos/Originate/git-town/issues/65","labels_url":"https://api.github.com/repos/Originate/git-town/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/Originate/git-town/issues/65/comments","events_url":"https://api.github.com/repos/Originate/git-town/issues/65/events","html_url":"https://github.com/Originate/git-town/issues/65","id":45413938,"number":65,"title":"Save previous branch","user":{"login":"allewun","id":1256911,"avatar_url":"https://avatars.githubusercontent.com/u/1256911?v=3","gravatar_id":"","url":"https://api.github.com/users/allewun","html_url":"https://github.com/allewun","followers_url":"https://api.github.com/users/allewun/followers","following_url":"https://api.github.com/users/allewun/following{/other_user}","gists_url":"https://api.github.com/users/allewun/gists{/gist_id}","starred_url":"https://api.github.com/users/allewun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allewun/subscriptions","organizations_url":"https://api.github.com/users/allewun/orgs","repos_url":"https://api.github.com/users/allewun/repos","events_url":"https://api.github.com/users/allewun/events{/privacy}","received_events_url":"https://api.github.com/users/allewun/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Originate/git-town/labels/feature","name":"feature","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"allewun","id":1256911,"avatar_url":"https://avatars.githubusercontent.com/u/1256911?v=3","gravatar_id":"","url":"https://api.github.com/users/allewun","html_url":"https://github.com/allewun","followers_url":"https://api.github.com/users/allewun/followers","following_url":"https://api.github.com/users/allewun/following{/other_user}","gists_url":"https://api.github.com/users/allewun/gists{/gist_id}","starred_url":"https://api.github.com/users/allewun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allewun/subscriptions","organizations_url":"https://api.github.com/users/allewun/orgs","repos_url":"https://api.github.com/users/allewun/repos","events_url":"https://api.github.com/users/allewun/events{/privacy}","received_events_url":"https://api.github.com/users/allewun/received_events","type":"User","site_admin":false},"milestone":null,"comments":9,"created_at":"2014-10-09T20:35:06Z","updated_at":"2015-04-21T16:50:20Z","closed_at":null,"body":"I frequently use `git checkout -` to switch to a previous branch.\r\n\r\nScenario:\r\n* Currently on feature branch `A`\r\n* Checkout another feature branch: `git checkout B`\r\n* `git ship`\r\n* After shipping, current branch will be `<main_branch_name>`\r\n* I'd expect `git checkout -` to take me to `A` at this point. In actuality, git is trying to take me to the true previous branch, which is B (which has just been shipped and deleted).\r\n\r\nSince `git ship` feels like an atomic operation, I'm frequently wanting to go back to the original branch I was on before shipping. Does this issue make sense?"},"comment":{"url":"https://api.github.com/repos/Originate/git-town/issues/comments/94867495","html_url":"https://github.com/Originate/git-town/issues/65#issuecomment-94867495","issue_url":"https://api.github.com/repos/Originate/git-town/issues/65","id":94867495,"user":{"login":"kevgo","id":268934,"avatar_url":"https://avatars.githubusercontent.com/u/268934?v=3","gravatar_id":"","url":"https://api.github.com/users/kevgo","html_url":"https://github.com/kevgo","followers_url":"https://api.github.com/users/kevgo/followers","following_url":"https://api.github.com/users/kevgo/following{/other_user}","gists_url":"https://api.github.com/users/kevgo/gists{/gist_id}","starred_url":"https://api.github.com/users/kevgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevgo/subscriptions","organizations_url":"https://api.github.com/users/kevgo/orgs","repos_url":"https://api.github.com/users/kevgo/repos","events_url":"https://api.github.com/users/kevgo/events{/privacy}","received_events_url":"https://api.github.com/users/kevgo/received_events","type":"User","site_admin":false},"created_at":"2015-04-21T16:50:20Z","updated_at":"2015-04-21T16:50:20Z","body":"An easy and robust (but rather primitive) solution to build this would be:\r\n* stash away open changes\r\n* determine the previous Git branch and store it in a variable\r\n* run the Git Town logic\r\n* checkout the previous branch\r\n* checkout the current branch\r\n* pop the stash\r\n\r\nThis puts the previous branch back into the Git history. Given that the open changes are stashed away, this should be clean, without conflicts."}}