The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,527 other followers

Archive for the ‘DVCS – Distributed Version Control’ Category

AlessandroZ/LaZagne: Credentials recovery project

Posted by jpluimers on 2019/04/15

Just when I thought I made a note of a password I hardly ever use, I didn’t, luckily this open source tools understands how to recover many kinds of passwords: AlessandroZ/LaZagne: Credentials recovery project.

–jeroen

Posted in *nix, *nix-tools, Chrome, Development, DVCS - Distributed Version Control, Firefox, git, Internet Explorer, Office, Opera, Outlook, Power User, Python, Scripting, Skype, Software Development, Source Code Management, Web Browsers, WiFi, Windows | Leave a Comment »

git – How to read last commit comment? – Stack Overflow

Posted by jpluimers on 2019/04/12

For only the latest commit message:

git log -1 --pretty=%B

For the full commit without diff:

git log -1

For the full commit including diff:

git show

Via: [WayBack] Often during a commit … I wish to read my last comment to remember what progress I have made (thanks Charles-Bailey!)

–jeroen

Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »

During git mv (rename): “unable to unlink old” “invalid argument”

Posted by jpluimers on 2019/03/20

I had an error when doing a rename (mv) in git “unable to unlink old” “invalid argument”. This appeared to be a process having a lock on that file.

In my case, this was a bit hard to track down (I used Process Explorer for it), as the culprit was SourceTree running git in the background to keep an eye on changes in the repository because it has a file system watcher on the repository tree and a different process was writing log files in the same directory structure.

Can you still follow? I had a hard time so here it is in manageable bits:

  1. By default SourceTree has a file system watcher on your repositories
  2. If that watcher fires, SourceTree runs a background git process to get the current state of the repository
  3. If you perform UI actions, SourceTree runs a foreground git process to perform the action
  4. SourceTree does not have a mechanism to wait for the background git process to finish before running the foreground process
  5. I had had another process running that logged into a relative directory that happened to be within the repository tree (but using files excluded by .gitignore)

Basically SourceTree should do two things:

  • keep track of the background process and not fire a foreground one
  • do not start the background process for files excluded by .gitignore

I tracked down what happened using these tips:

–jeroen

Posted in Development, DVCS - Distributed Version Control, git, Source Code Management | Leave a Comment »

How can I rename a git stash? – Stack Overflow

Posted by jpluimers on 2019/03/07

SourceTree does not like it when by accident two git stash entries have exactly the same name.

To work around that, you have to rename one.

The easiest way to do this is on the console using the tips from [WayBack] How can I rename a git stash? – Stack Overflow (thanks [WayBack] qzb):

$ git stash list
stash@{0}: WIP on master: Add some very important feature
stash@{1}: WIP on master: Fix some silly bug

First, you must remove stash entry which you want to rename:

$ git stash drop stash@{1}
Dropped stash@{1} (af8fdeee49a03d1b4609f294635e7f0d622e03db)

Now just add it again with new message using sha of commit returned after dropping:

$ git stash store -m "Very descriptive message" af8fdeee49a03d1b4609f294635e7f0d622e03db

And that’s it:

$ git stash list
stash@{0}: Very descriptive message
stash@{1}: WIP on master: Add some very important feature

This solution requires git 1.8.4 or later, and yes, it works with dirty working directory too.

Some other useful git stash commands:

–jeroen

Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management, SourceTree | Leave a Comment »

Move the most recent commit(s) to a new branch with Git – Stack Overflow

Posted by jpluimers on 2019/03/05

Below are the git statements I used to solve this ASCII art problem from me (as I work in Git Flow feature branches):

old situation:

commit-1..4  -  commit-5  -  commit-6  -  commit-7  -  commit-8  -  commit-9
                   ^            ^            ^            ^           ^
                   |            |            |            |           |
                master       develop      feature/A                 feature/old

to:

commit-1..4  -  commit-5  -  commit-6  -  commit-7  -  commit-8  -  commit-9
                   ^            ^            ^            ^           ^
                   |            |            |            |           |
                master       develop      feature/A    feature/old  feature/new

 

git branch
git rev-parse HEAD
git log --pretty=format:'%H' -n 2
git checkout -b feature/new hash-of-commit-8
git branch --set-upstream-to=feature/old
git cherry-pick ..feature/old
git branch --force feature/old hash-of-commit-8

Step by step, this is what happens:

  1. branch lists the current branches
  2. rev-parse HEAD shows the hash of the current commit (commit-9)
  3. log --pretty=format:'%H' -n 1shows the hash of the previous two commits (from top to bottom: commit-9 and commit-8)
  4. checkout creates a new branch based on the past commit-8
  5. branch --set-upstream ensures the new branch tracks the old branch
  6. cherry pick ensures the new branch gets all the commits from the old branch
  7. branch --force ensure the old branch looses the extra commits you wanted to only be in newBranchName

Based on

–jeroen

Posted in Development, DVCS - Distributed Version Control, git, Power User, Software Development, Source Code Management | Leave a Comment »

 
%d bloggers like this: