0
I Use This!
Activity Not Available

Project Summary

Perhaps you wanna try Git StashThe difference with 'git checkout' is that it switches branches with uncommitted changes saved automatically. So uncommitted changes are isolated between branches.

If you want to discard, merge changes, or checkout files, use the official 'git checkout ' please.

Changes are just diff against HEAD, don't forget to use this command too when you switch back.

Githttp://github.com/nkchenz/git-switch-branch/tree/master

Concept1. figure out which branch we are on

2. save diff HEAD and index of current branch

3. reset current branch to HEAD

4. call original git-checkout to checkout new branch

5. restore diff and index of new branch if they exist

Installcp git-switch-branch /usr/bin/git-switch-branch
git config --global alias.sb switch-branchExampleREADME and TODO are both changed and uncommitted on master and fatzap, and you can switch just as you like:

ideer@ideer:/home/chenz/ZFSpy$ git br
fatzap
* master
ideer@ideer:/home/chenz/ZFSpy$ git st
# On branch master
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
# modified: TODO
#
# Changed but not updated:
# (use "git add ..." to update what will be committed)
#
# modified: README
#
ideer@ideer:/home/chenz/ZFSpy$ git df HEAD
diff --git a/README b/README
index a8c2cdc..eb51b27 100644
--- a/README
+++ b/README
@@ -22,3 +22,5 @@ Examples

See zfspy/example.py.

+test
+on branch master
diff --git a/TODO b/TODO
index 044426f..e1f54cc 100644
--- a/TODO
+++ b/TODO
@@ -7,3 +7,5 @@ snap lookup
diff snaps

fat zap
+
+on branch master
ideer@ideer:/home/chenz/ZFSpy$ git sb fatzap
Switched to branch "fatzap"
ideer@ideer:/home/chenz/ZFSpy$ git st
# On branch fatzap
# Changed but not updated:
# (use "git add ..." to update what will be committed)
#
# modified: README
# modified: TODO
#
no changes added to commit (use "git add" and/or "git commit -a")
ideer@ideer:/home/chenz/ZFSpy$ git df HEAD
diff --git a/README b/README
index a8c2cdc..5138436 100644
--- a/README
+++ b/README
@@ -22,3 +22,5 @@ Examples

See zfspy/example.py.

+test
+on fatzap
diff --git a/TODO b/TODO
index 044426f..57e289d 100644
--- a/TODO
+++ b/TODO
@@ -7,3 +7,4 @@ snap lookup
diff snaps

fat zap
+on branch fatzap
ideer@ideer:/home/chenz/ZFSpy$ git sb master
Switched to branch "master"
ideer@ideer:/home/chenz/ZFSpy$ git st
# On branch master
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
# modified: TODO
#
# Changed but not updated:
# (use "git add ..." to update what will be committed)
#
# modified: README
#
ideer@ideer:/home/chenz/ZFSpy$ git df HEAD
diff --git a/README b/README
index a8c2cdc..eb51b27 100644
--- a/README
+++ b/README
@@ -22,3 +22,5 @@ Examples

See zfspy/example.py.

+test
+on branch master
diff --git a/TODO b/TODO
index 044426f..e1f54cc 100644
--- a/TODO
+++ b/TODO
@@ -7,3 +7,5 @@ snap lookup
diff snaps

fat zap
+
+on branch master
ideer@ideer:/home/chenz/ZFSpy$
ProblemsWhen switching back, we do not check that whether the branch are touched or not after your last switching, and if it's not at HEAD, there might be problems when applying diff.

So becarefull when you mix use git-switch-branch and git-checkout.

Tags

git switch-branch uncommittedchanges

In a Nutshell, git-switch-branch...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

GNU General Public License v2.0 or later
Permitted

Place Warranty

Commercial Use

Modify

Distribute

Forbidden

Sub-License

Hold Liable

Required

Distribute Original

Disclose Source

Include Copyright

State Changes

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    by exploring contributors within projects, you can view details on every commit they have made to that project
  • ...
    55% of companies leverage OSS for production infrastructure
  • ...
    you can embed statistics from Open Hub on your site

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!
Sample ohloh analysis