![]() ![]() You may chop and slice the other branches as you like, but you never cut-off the trunk (aka the master branch) of the tree.īy doing so, we ensure that, there will always be a way, to trace/find any commit pushed to the remote master. Making master a protected branch is considered a best practice. You can check these settings in the Repository section in Settings on the repository page on Gitlab. Any destructive operation on the remote master will fail. The master branch on Gitlab is "protected" by default. Why did the push fail even when we force it? ![]() The push, however, will still not succeed. SmartGit will ask for a confirmation, informing that the push will replace the remote branch. The flag -f or -force forces the commit, overwriting the remote branch if needed. Note: You can also do this from the command line by running git push -f origin master. ![]() We will, for once, ignore SmartGit's warning. Go ahead and modify the setting as told in the dialog box. SmartGit will prevent the operation, warning us that the push operation might result in commits being overwritten. Push the master branch as we have reset the local branch to a previous commit. We can see that the remote master branch is now ahead of our local branch. In a soft reset, the changes made after the commit that we've reset to, are not discarded but staged for the next commit. We've tried resetting in part 1, this time we will do a soft reset. Inside SmartGit's log view, right click on the done for part 5 commit and select Reset. As we've done this a bunch of times now, there shouldn't be any hiccups. Go ahead and fork and the repository we'll be using. This final part will cover a few important concepts that any Git master should know. We already have the basic workflow drilled in. You now have a solid foundation of the core concepts of Version Control with Git.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |