git/HEAD and it contains the 40 bytes SHA-1 of the current commit. There can only be a single HEAD at any given time (excluding git worktree). HEAD is simply a reference to the current commit (latest) on the current branch. # Now use git cat-file -p to print those hashesīefore answering, let's add some background, explaining what this HEAD is. Option 3 - If you added those files grab them from the staging area but you will need to find them # Find all dangling files If you care about history and the branch structure, then you can use git revert.- Option 1 - which you mentioned you already did: use git reflog & git reset If you don’t care about keeping the same branch, then you can use git checkout. If you don’t care about commit history, you should use git reset. This can create problems if other contributors have made changes that conflict with those that you are pushing, so you need to make sure you communicate clearly with others and coordinate your changes carefully. This will overwrite any commits that were made after your last pull. If you decide to use git reset or git checkout to overwrite commits, then you can use git push -force to overwrite the remote branch with your local branch. Other contributors will be able to see the commit was reverted and adjust their work accordingly. Instead it creates a new commit that undoes the changes introduced in a previous commit while retaining the history of the origin commit.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |