You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git push origin --tags ## send all tags to the repository
git push origin tag ## send the tag to the repository
git show v0.0.000 ## view tag content
git tag ## view all tags
git tag -a v0.0.000 -m "TASK-xxx" ## create a tag with a version and a comment
git tag -a v0.0.000 0011223344 ## create a tag with the version to commit on the hash part
git tag -d v0.0.000 ## delete a tag
git tag -l *v0.0* ## search for tags by mask
git stash ## hide the changes in a special stash section
git stash list ## list of hidden changes
git stash apply ## apply the last stash
git stash apply stash@{2} ## apply the specified stash
git stash apply --index ## apply the last stash and make changes to the index
git stash drop ## delete the last files placed in the temporary stash
git stash pop ## apply hidden changes and immediately remove them from the stack
git stash branch ## create branches from hidden changes
How to revert uncommitted changes including files and folders?
git reset --hard ## Revert changes to modified files.
git clean -fd ## Remove all untracked files and directories.
Revert changes
git checkout . ## revert changes made to your working copy for all directories and files
git checkout [folder/file] ## revert changes made to your working copy for directory/file
git reset [folder/file] ## revert changes made to the index
git revert [commit 1] [commit 2] ## revert a change that you have committed
git clean -f ## remove untracked files
git clean -fd ## remove untracked directories
Exclude files from commit
Need first gitignore and then files.
git rm -r --cached . || git rm --cached || git rm --cached [file-name] || git rm -r --cached [folder-name]
git add .
git commit -m ".gitignore"
git remote show origin ## view and copy push URL
git remote show second ## view and copy push URL
git remote add all https://github.com/...git ## add new remote 'all' repo with 'origin' repo link
git remote set-url --add all https://...git ## add second repo into "all" repo
git remote remove origin ## remove 'origin' repo
git remote remove second ## remove 'second' repo
git pull all main ## get remote main branch
git push -u all main ## set upstream
git push ## push changes
git pull ## get remote branch
Make current stash, rollback to need commit, publish need commit, restore the stash
git stash ## make stash
git hist ## view commits hashes
git checkout <hash2> ## move HEAD to commit 2
## make product publish
git restore . ## restore all files after publish
git hist ## view commits hashes
git checkout <hash1> ## move HEAD to 'commit 1'
git branch -f main <hash1> ## move the 'main' branch to 'commit 1'
git checkout main ## move HEAD to the 'main' branch
git stash list ## view list of stashes
git stash apply stash@{0} ## apply the backup stash
git stash drop ## drop the backup stash