how to list all uncommitted changes made only in current branch in git
when i started with branching my master branch was clean nothing to commit.
Then I created new branch feature1
git checkout -b feature1
i made my changes in branch feature1 added some js and css files . Then i created another branch from master branch without committing changes made to branch feature1 like so :
git checkout master git checkout -b feature2
i added some more code in feature2 branch and added some new css files and then again i created another branch feature3 from master with committing changes in branch feature2 like this :
git checkout master git checkout -b feature 3
I added some new code in feature3 branch with 1 new css file . now when i did :
I got list of all files which i modified but not committed in all the 3 branches . I was expecting that i will get only list of file modified in current branch i.e branch feature3 , now i don’t remember which files I created in which branch .
Can anyone please help me to list only files i created or modified in particular branch and commit them. to respective branches .
list all files modified or created in feature1 branch and commit them to feature1 branch and do this with all 3 branches.
I also want to know how i can create a branch from master branch without getting other files which are modified in other branch but not committed . i.e i want the new branch to be exact clone of master with noting to commit.
3 Solutions collect form web for “how to list all uncommitted changes made only in current branch in git”
As mentioned by @abeaumet if you create files but don’t commit them, you can’t track them when you change branches.
This is because they are in your working tree and not your git repository. Your working tree is effectively a checked out version of your repository, plus any changes you’re currently making. Moving around branches does not delete these untracked files, git is leaving them in your working tree so they don’t get deleted.
Read some of the articles linked in this question to understand the difference between your repository and the working tree.
gitk --all and you can inspect you can inspect all your branches, changes, whatever. Select a point and right-click on another and from top of the menu you get diff of two versions.
A branch in git is just a ‘label’ on a commit. If you create a branch on top of the master, it is as perfect “clone” as you can get. Though really it’s just a 41 byte file containing the same hash.
I think you should familiraize yourself a bit with what is what, from the description I could not deduce what you did and especially what you’re after.
It’s not possible to determine on which branch a file was created if you didn’t commit it.