Git rebase - re-create result of a command (yarn.lock file, etc) - git-rebase

Getting this error:
Executing: git reset --soft HEAD~ && git restore --staged yarn.lock && git restore yarn.lock && yarn install && git add yarn.lock && git rebase --continue
yarn install v1.22.19
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
[3/5] 🚚 Fetching packages...
[4/5] 🔗 Linking dependencies...
[5/5] 🔨 Building fresh packages...
success Saved lockfile.
✨ Done in 10.29s.
error: could not open '/Users/devinrhode2/repos/myco/tess1/.git/worktrees/tess3/rebase-merge/author-script' for reading: No such file or directory
error: you have staged changes in your working tree
If these changes are meant to be squashed into the previous commit, run:
git commit --amend
If they are meant to go into a new commit, run:
git commit
In both cases, once you're done, continue with:
git rebase --continue
error: could not commit staged changes.
error: cannot rebase: Your index contains uncommitted changes.
warning: execution failed: git reset --soft HEAD~ && git restore --staged yarn.lock && git restore yarn.lock && yarn install && git add yarn.lock && git rebase --continue
and made changes to the index and/or the working tree
You can fix the problem, and then run
git rebase --continue
hint: Could not execute the todo command
hint:
hint: exec git reset --soft HEAD~ && git restore --staged yarn.lock && git restore yarn.lock && yarn install && git add yarn.lock && git rebase --continue
hint:
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint:
hint: git rebase --edit-todo
hint: git rebase --continue
The spirit of what I'm trying to do, is essentially re-generate the changes to yarn.lock file from the previous commit (but on the new base). It's easier to simply re-generate the changes than to validate them.

It seems you simply still need to commit the changed yarn.lock file. You do a git add command, which stages the file, but does not actually commit the result. Therefore at the point where you are trying to continue the rebase, your git working tree is still dirty, so git refuses to continue the rebase.
As git already indicates itself, you should add a git commit or git commit --amend command

#Johan
It's looking like this rebase recipe may look something like:
pick 6a33e8ebe Run `yarn add eslint --dev`
exec LAST_MSG=$(git log -1 --format=%B 6a33e8ebe); git reset --soft HEAD~ && git restore --staged yarn.lock && git restore yarn.lock && yarn install && git add yarn.lock && git commit -m "$LAST_MSG"
Of course, there's the complication of actually getting that hash in there for the LAST_MSG - should be able to reference just HEAD tho, I think.
UPDATE:
Actually, ideal pattern is for commands to have their own single commit, and do:
drop bde6f678a Run `yarn prettier --write README.md .eslintrc.js`
exec yarn prettier --write README.md .eslintrc.js && git commit -am "Run `yarn prettier --write README.md .eslintrc.js`"
Git should probably introduce a commit message syntax like:
git commit -am "exec! yarn prettier --write README.md .eslintrc.js"
When rebasing, it would basically expand to this:
drop bde6f678a Run `yarn prettier --write README.md .eslintrc.js`
exec yarn prettier --write README.md .eslintrc.js && git commit -am "exec! yarn prettier --write README.md .eslintrc.js"
Commits can never be small enough!

Related

clone fails with "smudge filter lfs failed (...) HTTP_1_1_REQUIRED"

I'm trying to clone a git repo from my corp locally-hosted TFS/devops. However, I get failure:
batch response: Post (...) HTTP_1_1_REQUIRED
I saw recommendation to skip smudge by running git lfs install --skip-smudge
or setting GIT_LFS_SKIP_SMUDGE=1, but then the lfs-provided binaries don't get pulled and I get compile errors.
Solution - Before clone, run: git config --global --replace-all http.version HTTP/1.1
Ref, from the git-lfs developer which added the http.version option: https://github.com/git-lfs/git-lfs/issues/3875#issuecomment-607260728

Use git installed in Windows Subsystem for Linux in VSCode

I installed git through WSL2:
Arch Linux on Windows 10 x86_64 with 4.19.84-microsoft-standard
$ which git
/usr/sbin/git
From cmd I can either use git via wsl.exe git ... or via a batch file I made to access wsl programs:
> wsl git status
On branch next
...
> git.bat status
On branch next
...
However git does not work:
Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Program Files (x86)\Git\cmd\git.exe
Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Users\x\AppData\Local\Programs\Git\cmd\git.exe
Git installation not found.
What I tried so far:
I moved my git.bat to C:\Users\x\AppData\Local\Programs\Git\cmd\git.bat
I put an explicit git path in the settings json:
{
"git.enabled": true,
"git.path": "C:\Windows\System32\wsl.exe git",
// ...
}
Which does not work either:
Looking for git in: C:\Windows\System32\wsl.exe git
Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Program Files (x86)\Git\cmd\git.exe
Looking for git in: C:\Program Files\Git\cmd\git.exe
Looking for git in: C:\Users\x\AppData\Local\Programs\Git\cmd\git.exe
Git installation not found.
What can I do if I don't want to install git for Windows?
Fixed it using
VSCode: use WSL Git instead of Git for Windows
https://github.com/andy-5/wslgit

How to do_fetch by hand in a Yocto Project

My question is raised because my build-yocto server ran into the error:
ERROR: Fetcher failure: Fetch command failed with exit code 128, output:
Cloning into bare repository '/mnt/wd2tb/home/Work/skrzg1h_iWg21m_QtHmi/build/downloads/git2/github.com.qtproject.qtenginio.git'...
Fetcher failure for URL: 'git://github.com/qtproject/qtenginio.git;name=qtenginio;branch=5.6;protocol=git'. Unable to fetch URL from any source.
In the meantime, my PC can do that. So, I cloned the qtenginio repo to my local PC.
$ git clone git://github.com/qtproject/qtenginio.git;name=qtenginio;branch=5.6;protocol=git
And copy the downloaded source code above into the downloads/git2/github.com.qtproject.qtenginio.git folder of Yocto project.
Finally, I run the bitbake command.
$ bitbake qtenginio
But the fetch still fails.
Anyone can help me in this case ?
bitbake clones bare git repo, please add option '--bare' and touch a .done file to tell bitbake that do_fetch has been done already:
$ git clone --bare git://github.com/qtproject/qtenginio.git;name=qtenginio;branch=5.6 /mnt/wd2tb/home/Work/skrzg1h_iWg21m_QtHmi/build/downloads/git2/github.com.qtproject.qtenginio.git
$ touch /mnt/wd2tb/home/Work/skrzg1h_iWg21m_QtHmi/build/downloads/git2/github.com.qtproject.qtenginio.git.done
Step 1: download the package by hand (wget, git clone ...)
Step 2: copy the package into ./build/downloads
Step 3: touch a package_name.done file.
Step 4: change permission for the *.done file: chmod 777 package_name.done

Connection error with cocoapods. Proxy CONNECT aborted

I have problem with instalation cococapods. I have done following steps in terminal:
~sudo gem update --system
~sudo gem install cocoapods
and after
~pod setup
I have this error message
MacBook-Pro-Aleksandr:~ aleksandrkarpov$ pod setup
Setting up CocoaPods master repo
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --depth=1
Cloning into 'master'...
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': Proxy CONNECT aborted
I worked before with cocoapods and it was ok. In this case I don't know what to do. Can anyone help me, please?
I found solution here.
I wrote only in terminal:
git config --global http.proxy
git config --global --unset http.proxy
and it resolved my problem.

Can't build Facebooks HHVM from Github (git submodule init)

When I run these steps:
mkdir dev
cd dev
git clone git://github.com/facebook/hhvm.git
cd hhvm
git submodule init
export CMAKE_PREFIX_PATH=`pwd`/..
export HPHP_HOME=`pwd`
cd ..
url: https://github.com/facebook/hhvm/wiki/Building-and-installing-HHVM-on-Ubuntu-12.04
I get stuck at the git submodule init I get the error: Submodule 'hphp/submodules/folly' () registered for path 'hphp/submodules/folly'
I have no clue what it means and it doesn't look like a fatal error...
UPDATE:
git submodule sync does sync php/submodules/folly but still the same error...
I would try:
git submodule update --init --recursive
And make sure that "Submodule 'xxx' registered for path 'yyy'" is indeed an error message: it looks like a standard answer for a git submodule init command.
From the git submodule book page:
The rack directory is there, but empty.
You must run two commands:
git submodule init to initialize your local configuration file, and
git submodule update to fetch all the data from that project and check out the appropriate commit listed in your superproject:
$ git submodule init
Submodule 'rack' (git://github.com/chneukirchen/rack.git) registered for path 'rack'
$ git submodule update
Initialized empty Git repository in /opt/myproject/rack/.git/
remote: Counting objects: 3181, done.
remote: Compressing objects: 100% (1534/1534), done.
remote: Total 3181 (delta 1951), reused 2623 (delta 1603)
Receiving objects: 100% (3181/3181), 675.42 KiB | 173 KiB/s, done.
Resolving deltas: 100% (1951/1951), done.
Submodule path 'rack': checked out '08d709f78b8c5b0fbeb7821e37fa53e69afcf433'
I prefer running only one command:
git submodule update --init