-merge: moves HEAD, resets the staging area, and tries to move all the changes in your working tree into the new working tree.-mixed: moves HEAD and updates the staging area, but not the working tree.-soft: moves HEAD but doesn't touch the staging area or the working tree.Reset to a remote branch $ git fetch origin To uncommit and revert local changes $ git reset HEAD~ -hard To uncommit but does not revert local changes $ git reset HEAD~ To revert changes made to your working copy $ git restore. # Go back to the commit before HEAD # i.e. Don't use git revert, use: # Go back to HEAD Abandon ChangesĪbandon changes and revert your tree to the "clean" state of your current branch. Now all the changes done in that commit are unstaged and need to be committed again. To add everything to stage, including additions and removals, use $ git add -A Show the name $ git config -local user.name Set a name $ git config -global user.name "My Name" Or $ git checkout -b -track / Diff $ git diff. detached: HEAD is pointing directly to a commit instead of a branch.attached: in the normal state, HEAD is attached to a branch.HEAD is synonymous with "the last commit in the current branch." Most of the time, HEAD points to a branch name. In Git, a branch is a pointer to one specific commit, while a commit is a snapshot of your repository at a specific point in time. git reset -hard HEAD^ (changes are thrown away, not even in the working tree).git reset HEAD^ (files are no longer stage, but still in the working area).git reset -soft HEAD^ (files are still staged).Local Repo => Staging Area / Working Tree:.Staging Area => Working Tree (Unstage): git reset HEAD / git restore -staged.Working Tree => Staging Area: git add / git rm.So it doesn't matter what branch you're on when you add a file. The staging area (index) is shared by all branches committed code (in local repository) is per branch. local "cached" copy of a remote repository.local repo: your own repository with your own commit history.the working copy: where you are editing and building (not committed yet to your repo).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |