Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to list all uncommitted changes made only in current branch in git

I am a newbie to git initially i used to work only on master branch then i read a little about git branching and i was amazed by it power so i started using branches in my workflow

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 :

git status

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 .

For e.g

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.

like image 640
user2373881 Avatar asked Jun 26 '13 12:06

user2373881


1 Answers

Just launch gitk --all and 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.

like image 106
Balog Pal Avatar answered Nov 15 '22 08:11

Balog Pal