संदर्भ: मैं एक साधारण सुविधा को जोड़ने के लिए मास्टर पर काम कर रहा हूं। कुछ मिनटों के बाद मुझे एहसास हुआ कि यह इतना आसान नहीं था और नई शाखा में काम करना बेहतर होना चाहिए था।
यह हमेशा मेरे साथ होता है और मुझे पता नहीं है कि किसी अन्य शाखा में कैसे स्विच किया जाए और मेरे साथ इन सभी असम्बद्ध परिवर्तनों को मास्टर शाखा को छोड़ दें। मुझे लगता है कि git stash && git stash branch new_branch
बस यह पूरा होगा, लेकिन यह मुझे मिलता है:
~/test $ git status
# On branch master
nothing to commit (working directory clean)
~/test $ echo "hello!" > testing
~/test $ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: testing
#
no changes added to commit (use "git add" and/or "git commit -a")
~/test $ git stash
Saved working directory and index state WIP on master: 4402b8c testing
HEAD is now at 4402b8c testing
~/test $ git status
# On branch master
nothing to commit (working directory clean)
~/test $ git stash branch new_branch
Switched to a new branch 'new_branch'
# On branch new_branch
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: testing
#
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (db1b9a3391a82d86c9fdd26dab095ba9b820e35b)
~/test $ git s
# On branch new_branch
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: testing
#
no changes added to commit (use "git add" and/or "git commit -a")
~/test $ git checkout master
M testing
Switched to branch 'master'
~/test $ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: testing
#
no changes added to commit (use "git add" and/or "git commit -a")
क्या आप जानते हैं कि इसे पूरा करने का कोई तरीका है?