You are an internal in a company, this is your first work since you are an adult.
First day, you boss told you to
Clonethe company's project from GitHub and get familiar with it. You know how to do it, just type:git clone ...Next day, you need to submit some
featorfixPR to the upstream branch. Still ok:git checkout -b feat/somethingFew days later, your boos walks over: A contributor's PR have conflict, you need to review his code and give him a
suggestionto resolve the conflict.Usually, on your local and your own branch, you just type:
git checkout branch→git pull upstream main --rebase→resolve the conflict in localandgit push --force-with-lease origin branchBut in this way, you found there are two conflict, but in GitHub, there should be only one conflict ???
Finally, you Boss told you how to do it right:
git remote add whhe git@github.com:whhe/ragflow
git fetch whhe
git checkout upstream/main
git merge whhe/feat-bedrock-api-key-authLike dude, what fk is this bro?
This was basically my experience while interning on infiniflow/ragflow. And that PR review is here
To be honest, I only know
git clone ...
git add .
git commit -m ""
git push # I like to use `--force`, although I know the consequence :)before my internship in Infiniflow
Gogit is a Git CLI assistant written in Go.
Gogit requires Go 1.25 or later and Git. Clone this repository, enter its directory, and install the executable into your Go binary directory.
git clone https://github.com/Haruko386/Gogit.git
cd Gogit$installDir = go env GOBIN
if ([string]::IsNullOrWhiteSpace($installDir)) {
$installDir = Join-Path (go env GOPATH) "bin"
}
New-Item -ItemType Directory -Force $installDir | Out-Null
go build -o (Join-Path $installDir "gogit.exe") .
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
if (($userPath -split ";") -notcontains $installDir) {
$newPath = if ($userPath) { "$userPath;$installDir" } else { $installDir }
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
}
$env:Path += ";$installDir"install_dir="$(go env GOBIN)"
if [ -z "$install_dir" ]; then
install_dir="$(go env GOPATH)/bin"
fi
mkdir -p "$install_dir"
go build -o "$install_dir/gogit" .Add that directory to your shell's PATH if it is not already available:
# Bash
echo 'export PATH="$(go env GOPATH)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# Zsh (the default shell on modern macOS)
echo 'export PATH="$(go env GOPATH)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcIf you configured a custom GOBIN, add that directory instead of
$(go env GOPATH)/bin.
Verify the installation from a new terminal or any directory:
gogitThis opens the Gogit-assisted shell. Type Git commands normally and press
Ctrl+D on an empty input line when you want to leave Gogit.
For dangerous commands, Gogit should eventually be able to tell you that you're about to do something... interesting:
--force
Force push to the remote repository.
⚠ This may overwrite remote history.
--force-with-lease
Force push only when the remote branch has not unexpectedly changed.
✓ Usually safer than --force.
Because sometimes the most useful feature of a CLI assistant is not helping you type:
git reset --hardIt's stopping you for half a second before you do it.
Important
If you use agent to operate git, bro, this is not what you need.
Just use your agent and let your brain go to waste.
(I'm not mean AI is harmful or that I want to ban it, I just think we should not let AI do everything, so that we won't forget something basic skill)
