git rename branch: change branch nameĪs I mentioned, having a branch naming convention a good practice and should be adopted as part of your coding standards, and it is especially useful in supporting automation of git workflows. Git tip: not sure when or why to use tags? Read here to learn more (TL DR: automatic releasing) 10. If you also need to delete the tag locally: `$ git tag -d `.If you have a remote tag to delete, and your remote is origin, then simply: `$ git push origin :refs/tags/`.How to delete tag by removing it from branch The best solution is to delete the tag and remove the connection between a release and its co-related tag. In the case of a “buggy” release, you probably don’t want someone to accidentally use the release linked to this tag. Git tip: diff-so-fancy is a great open source solution to make your diffs human readable. Comparing files between branches: `$ git diff branch1:file branch2:file`.Produce the diff between two branches from common ancestor commit: `$ git diff branch_1.branch_2`.Find the diff between the tips of the two branches: `$ git diff branch_1.branch_2`.You can do this using the $ git diff command. When you are working with multiple git branches, it’s important to be able to compare and contrast the differences between two different branches on the same repository. Use it to reduce the need to cancel commits. Git tip: git pre-commit hook is a built-in feature that lets you define scripts that will run automatically before each commit. To destroy the changes from the commit you want to undo: `$ git reset -hard HEAD^`.To keep the changes from the commit you want to undo: `$ git reset -soft HEAD^`.These are all legit reasons to undo your last commit. Maybe you committed secrets by accident – not a good idea – or maybe you want to add more tests to your code changes. ![]() The file will keep “living” in the repository history until the file will be completely deleted. Git tip: when a file is removed from Git, it doesn’t mean it is removed from history.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |