Git log --pretty=oneline appears to omit first 2 commits - macos

This might be a bug but I've never seen a bug in Git before, and I can't find any mention of this issue on the intertubes, so for now I'll assume user stupidity.
I use Git a great deal so I've set up an alias to bring up a birds-eye view of the git log: alias gl='git log --pretty=oneline --abbrev-commit'. So when I'm juggling between different branches, I'll frequently type gl to pull up the log, then q to exit. I find this super convenient.
But today I've noticed something strange: it looks like the most recent two commits are excluded from this view. Here's sample output from gl for one of my active projects:
b6e802d Location autocomplete; major refactoring and cleanup
d0cecdf Admin can download CSV of all users
0149ea2 Changed some verbiage on terms, privacy and profile page
5c0bdff Changed the link for find coach to go to the coaches page
But if I output gl to a file like gl > gitlog.txt, the first few lines are:
5e57f97 City autocomplete supported in mobile navbar search
df43a02 Add firstname & lastname to admin's users CSV download
b6e802d Location autocomplete; major refactoring and cleanup
d0cecdf Admin can download CSV of all users
0149ea2 Changed some verbiage on terms, privacy and profile page
5c0bdff Changed the link for find coach to go to the coaches page
Note that the top 2 lines in the latter are not present in the former.
If I open up the normal git log, all commits are visible as expected.
EDIT: I just discovered that I can work around this for now by piping (redundantly, I think) to less: gl | less shows all commits as expected.
I never noticed this happening before now (ie. the past couple weeks); I've recently updated to a newer Git version, could that be related? Has anyone else seen this happen? What should I do to figure out what's going on here? I don't even know where to start. Does this look like a bug?
Numbers:
Mac OSX 10.9.5
Git 2.2.1
Are any other numbers relevant?
Thanks for reading!

This isn't a complete answer, but I just made a couple observations:
This is only happening with one particular repository. The git log works fine on other projects.
I've added several more commits in the last day or two, and all of those commits are excluded. So it's not that the latest 2 commits are hidden so much as that every commit after a certain one are being excluded.
The earliest commit being hidden begins with the following line:
Add firstname & lastname to admin's users CSV download
Given the behavior of the error, I think there's a bug with Git's log printout that causes some commits to be hidden if a commit message contains &. So the lesson for me, for now, is to not use & in Git commit messages.

Just reproduced this behaviour happening with an old git version (2.6.x), but I updated it (2.19.1) and it was then fixed.

Related

Restoring an Xcode commit that was never pushed to Github

This is a question that I posted, and then after much digging finally resolved myself. There is actually quite a bit on this subject both on this forum and elsewhere, but it usually requires some familiarity with Terminal. I am going to describe the problem I faced and then describe step-by-step in detail (at a beginner's level) how to resolve the issue in Terminal.
In short, I checked out a previously committed version of my app in Xcode, which - because it was a version from several weeks prior - did not contain my most recent commits. In other words, I had no access to any of the commits that contained my most recent work. They had all disappeared.
My commits and pushes had not stored in GitHub because presumably some time before this I had accidentally selected my main folder as the destination for my commits, rather than one of the two branches I created. So I had absolutely no access to my work. By all appearances I pretty much had to start from scratch.
After much hand wringing, teeth gnashing, and hours of scouring the webs, I finally uncovered the solution. But it takes a bit of understanding about Terminal to make it work. So after several more hours of learning Terminal, I finally successfully restored all of my work.
For any of you who are new to coding (as I am), and who have no experience with Terminal, I will provide detailed instructions on how to resolve this issue if you encounter it in the answer below.
Open Terminal to prompt to your Xcode project. The easiest way to do this is to find your project in Finder, which will have a .xcodeproj extension, and then right click it.
Select New Terminal at Folder.
At this point, a terminal window will pop up. From here, enter the following: git reflog
Press Enter
This will populate a list of all the commits stored in your Xcode project. Each commit is identified by an alphanumeric code (the one I restored was 1a7ea33, for example).
Note the alphanumeric code of the commit you wish to restore.
After this, enter the following: git checkout -b NewBranch 1a1a1a1 (where "NewBranch" is whatever name you decide to name your new branch, and "1a1a1a1" is your alphanumeric code from steps 5 and 6).
Press Enter.
That's it. Close Terminal and open your Xcode project as normal. You will notice the restored commit in the folder you just named in Terminal.
Hopefully no one will ever need this, but if by chance someone does I hope it helps.

Can`t see the file history in Gitlens (on a specific project)

I have a problem with Gitlens extension. Firstly, Gitlens or Git History extension is working fine on any other project except the this Laravel project. My problem is, can`t see the file history or line history in this project.
On the other hand, there is no problem in the git log (Git History Extension) as seen in screenshot;
But I can't compare any files with their any version (every commit seems like in the ss). I have no idea what the problem is about.
Lastly, I don't think the problem is about extension settings because other projects do not have this problem. Is there a any chance to fix this issue without resetting git history?
I am answering after 3 months, maybe it works for someone. As I mentioned in the title, surely there is no problem about extension settings for this specific project. The problem is just about git files. Maybe, I damaged some git files while moving the project on my desktop :)
So, there is no chance to fix this issue without resetting git history or starting fresh with git, if you`re having the same problem.
Do not play with git files, it`s no joke!
I've got a similar issue. My problem is in using symbolic links for folders.
I have this folder symlink for my repos.
C:\>dir
Directory of C:\
27.09.2018 21:07 <JUNCTION> repos [C:\Users\Qwerty\repos]
(GitLens v11)
The top editor is opened via C:\repos
The bottom editor via C:\Users\Qwerty\repos
You can see that some git features still work (yellow), but others don't.
However, this is very strange, because in my other repos, I have never observed such issues.
Also notice below that it is still possible to invoke the same action via a git lens popup and then it is possible to use the Prev Next Revision buttons.
Anyway, after more testing, I actually observe the same thing in my other repos. I assume that something must have changed between versions as I only observe these issues for last maybe 2-3 months. I even submitted a ticket that GitLens stopped working in v12.0.0 and later versions https://github.com/gitkraken/vscode-gitlens/issues/1979
The buttons completely disappeared and even the commit information
v11
v12
And Now actually, after having reopened my repo via original path and after updating GitLens back to v12.0.6 I see that it is working properly!
Bottom editor is opened via C:\repos symlink.

git (windows) - find file that was saved locally but not committed/staged

I normally create new branches from master for different JIRA tasks and them merge them back into master with pull requests when the task is completed.
However, I'm using Rstudio and always have a local script open which acts a a rolling cookbook of tricks and tips to look back on. Basically its a library of my R knowledge.
Unfortunately I believe I've lost a couple of weeks work on this file as I think dropped any changes from the master branch, then created a new branch, created/edited a different file and merged back into master for a separate task.
I'm on Windows 10 and restore previous version doesn't seem to be available. The last restore point is a day after the last pull request I had merged. Im trying to find a way to find any other version of this file either in Git or older versions on my machine.
Whats the best way or tools to do this. I've lost some changes to an algorithm I'd been working on which successfully turned a 6 hour job into a 10 min job and I don't want to try and remember how I did it. I'm using visual studio for Git and I've got Git tortoise. According to tortoise There was a merge on 19/04 and nothing before 09/02 so I don't think Git ever staged or committed the changes I've lost that were all written between the 16/04 and 20/04.
EDIT
I think I've found it. Although its not in my Rstudio history in the UI (or the history file opened in notepad), when I use the search function in Rstudio's history it finds it?! Rstudio apparently has everything I've ever written and its timestamped too.
Still keeping this question open for future issues (although I've made this file local now to avoid this in the future). If anyone knows where the 'master' history file for Rstudio too thats of interest.
As mentioned in How to access the script/source history in RStudio?
RStudio's source panel is essentially a view to an Ace Editor
You have found the "searching history" which allows you to find back all past files/commands.

After successful merge changes not appearing in code base

enter image description hereHoping to find someone well versed in SVN to assist with a problem that has baffled both me and a colleague well experienced in SVN.
I recently was merging in new content to Trunk. I saw in the dialog box the files I'd edited all scroll down the screen as normal, and then received the 'Merge successful' message.
However, when I looked in Trunk none of the changes were present. In repo browser where you typically can see the author username of the most recent changes as well as the time stamp, it showed a previous merge not made by me.
Baffled, my colleague came to observe the whole process and confirmed that he was seeing the same thing: the merge appearing to succeed, but none of the updates persisting.
Has anyone seen this before, and could anyone offer any advice? I've spent a few hours googling at this point and am exhausting likely culprits.
You won't see merged changes in the repo browser until you commit those changes:
A merge only changes the files in your working copy, not directly in the repository.
Which means you have to first commit your changes.

Using xcode5 svn or git

I am learning git and SVN in Xcode 5.
My question:
How should I revert back my previous commit when I commit my code?
Is there a way on a branch to revert back to previous commits?
For example, I commit a state, call it GOODSPOT, then I commit, a few times as my code progresses. Can I easily revert back to GOODSPOT, in a single click ? Or do i have to go through line by line. Similar to going back to an old snap shot ?
https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/Conventions/Conventions.html
Here is what you can do
$ git push origin (branch)
You can go back to any commit you want to. Use the command-line interface (also known as Terminal).
As far as I'm concerned every time i try Source Control. It depends on whether you are working with people. I would just go back to the terminal and recommend it.
For versioning in Xcode, I do this:
- in my Developer directory I set up a project folder
- then Duplicate the Outer initial folder Xcode sets up and append its name with a number and two word description of where it's at
- this also duplicates development art, research notes etc
- the inner folder is all XCode cares about, so that one gets untouched
- when the finished app ships, I illustrate its development for proving copyright originality

Resources