git-gud | Slides of my talk about git
kandi X-RAY | git-gud Summary
kandi X-RAY | git-gud Summary
Slides of my talk about git
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of git-gud
git-gud Key Features
git-gud Examples and Code Snippets
Community Discussions
Trending Discussions on git-gud
QUESTION
I have much confusion about staging area. firstly, Git Gud: The Working Tree, Staging Area, and Local Repo tell me the staging area will be empty after git commit,on this way, git commit maybe move files to local branch rather than copy.
But it seemed this cant explain this practice:git reset --soft HEAD~ modifies staged snapshot?. git reset --soft HEAD^ after git commit, and then git status, it seemed there exist difference between staging area and HEAD^, and the difference is the files which has been committed after HEAD^. On this way, it seemed that staging area is not empty after git commit, or rather how to explain the difference between current HEAD and staging area if staging area is empty?
And another question is that the command
...ANSWER
Answered 2018-Aug-27 at 18:10The staging area contains the changes that you have specified to be part of a commit but have not yet committed.
When you do git add
, the changes are added to the staging until you actually run git commit
. After you have staged a file for committing, you could make additional changes and those will appear in the Changes not staged for commit:
part of git status
. When you actually do run git commit
, the changes that you had staged are used to make a new commit and the sha of this commit is made the new HEAD.
For your second question from the help docs of git diff
:
git diff [--options] --cached [] [--] [...] This form is to view the changes you staged for the next commit relative to the named . Typically you would want comparison with the latest commit, so if you do not give , it defaults to HEAD. If HEAD does not exist (e.g. unborn branches) and is not given, it shows all staged changes. --staged is a synonym of --cached.
Adding the modifier allows you to see what changes you have staged to be committed.
When you do git reset --soft HEAD~
, you are telling git to move the state of the repo to the commit previous to the one that the repo is currently pointing at but keep all of the changes to the files. So after running this command, your repo will have moved back on commit and doing git status
will show as modified all the files that were in the commit that HEAD was at previously.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install git-gud
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page