AL|EN Posted November 15, 2020 Share Posted November 15, 2020 @Luke Which GUI git client do you use? Does you repository has active forks which you receive contributions? Quote Link to comment
Luke Posted November 15, 2020 Share Posted November 15, 2020 1 minute ago, AL|EN said: @Luke Which GUI git client do you use? Does you repository has active forks which you receive contributions? I use VS Code when writing code and committing changes. My repository is private and I'm the only contributor. The "master" branch is the only branch... Quote Link to comment
AL|EN Posted November 15, 2020 Share Posted November 15, 2020 (edited) @Luke 1. Open VSCode Settings and enable 'Extensions > Git > Allow Force Push' 2. Use git log --oneline to get 'shortID' of the git commit hash: 3. Type git reset --hard 'shortID' Please remember that this will set the local files to the exact content of the commit! 4. Click Push (Force) from the "Pull, Push" submenu This will completely overwrite remote repository to the state of local copy - there is no truing back after this point! No backup! I recommend you to install GitLens extension - it might look like overkill but you can ignore almost all of the advanced stuff and focus on this nice view: Edited November 15, 2020 by AL|EN Quote Link to comment
Luke Posted November 16, 2020 Share Posted November 16, 2020 (edited) @AL|EN It worked! So, a couple of questions: Is this the extension you were talking about? Do you recommend signing commits locally using GPG? I've been using it for some time, the only thing I don't like is that past commits become "unverified" when a certain key expires, which is kinda misleading/unintended... Is there a way to update Git in Terminal instead of downloading the new version from its site? Thanks for your time. Edited November 16, 2020 by Luke Quote Link to comment
AL|EN Posted November 16, 2020 Share Posted November 16, 2020 @Luke - yes - just forget about it, or use something else than VSCode only for git-related tasks (I recommend SmartGit but GitHub Desktop should be enough for simple workflow) - you don't have to update git at all, there are no major features which are worth user attention, Windows version should have checkbox for 'auto-updater' which will notify you and install new version automatically. For manual install: If you have Windows 10 then install 'winget' and then use winget install 'Git' --silent If you have Windows 7, install https://chocolatey.org/install#individual and follow instruction regarding how to install packages Hope that this helps. Quote Link to comment
Luke Posted November 16, 2020 Share Posted November 16, 2020 3 hours ago, AL|EN said: you don't have to update git at all, there are no major features which are worth user attention And what about bug fixes and the like? Anyway, I'm on macOS, so I can't proceed as you suggested... Quote Link to comment
AL|EN Posted November 16, 2020 Share Posted November 16, 2020 @Luke Sure, bug fixes are important. For macOS you have brew, how I know this without having one and you don't Quote Link to comment
Luke Posted November 17, 2020 Share Posted November 17, 2020 @AL|EN Will check that out... Separately, do you know why GitHub Desktop asks me to clone a repository if I've already cloned it with VS Code? Should I instead click on "Add an Existing Repository from your hard drive"? Quote Link to comment
AL|EN Posted November 17, 2020 Share Posted November 17, 2020 @Luke Yes, you should use this options. It's rather basic stuff. Quote Link to comment
Luke Posted December 24, 2020 Share Posted December 24, 2020 @AL|EN Could you tell me if it's possible to format commit messages in GitHub Desktop? I suspect it's impossible but maybe I'm missing something... Quote Link to comment
AL|EN Posted December 27, 2020 Share Posted December 27, 2020 @Luke Nope, there isn't. Mainly because the commit messages are not suppose to have and git is not designed for such feature. Use changelog.md file for basic header/bold/numbered lists formatting or html if you want fancy colors. Quote Link to comment
Luke Posted December 27, 2020 Share Posted December 27, 2020 (edited) @AL|EN I see, will use "changelog.md" then... Separately, I'm having some troubles syncing forks. My fork is 5 commits behind (and 0 commits ahead of) the original project, but git fetch upstream does nothing... If I execute "git remote -v", it returns origin https://github.com/MY_USERNAME/MY_FORK.git (fetch) origin https://github.com/MY_USERNAME/MY_FORK.git (push) upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch) upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push) so I don't know what I'm missing... Edited December 27, 2020 by Luke Quote Link to comment
AL|EN Posted December 27, 2020 Share Posted December 27, 2020 @Luke git sync fork with upstream: https://stackoverflow.com/questions/20984802/how-can-i-keep-my-fork-in-sync-without-adding-a-separate-remote/21131381#21131381 - this post show you how to do it 'directly on the Github.com website'. After last step (Rebase and Merge), when they aren't any conflicts, you simply pull the updates which are now also inside your online fork into you local repository. Quote Link to comment
Luke Posted December 27, 2020 Share Posted December 27, 2020 11 minutes ago, AL|EN said: @Luke git sync fork with upstream: https://stackoverflow.com/questions/20984802/how-can-i-keep-my-fork-in-sync-without-adding-a-separate-remote/21131381#21131381 - this post show you how to do it 'directly on the Github.com website'. After last step (Rebase and Merge), when they aren't any conflicts, you simply pull the updates which are now also inside your online fork into you local repository. After clicking on "Rebase and Merge", my fork is now 4 commits ahead, 5 commits behind the original project... Guess there is still something wrong, right? Quote Link to comment
Mike1072 Posted December 28, 2020 Share Posted December 28, 2020 9 hours ago, Luke said: Separately, I'm having some troubles syncing forks. My fork is 5 commits behind (and 0 commits ahead of) the original project, but git fetch upstream does nothing... Fetching is just one of the first steps in the link you posted. You then have to merge the changes into your current branch. If you're dealing with the master branch, the command would be: git merge upstream/master Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.