git-workflow | 佳格研发的 git 使用规范 | Version Control System library
kandi X-RAY | git-workflow Summary
kandi X-RAY | git-workflow Summary
佳格研发的 git 使用规范
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of git-workflow
git-workflow Key Features
git-workflow Examples and Code Snippets
Community Discussions
Trending Discussions on git-workflow
QUESTION
I have an error during the LFS pull with Gitkraken on macOS. I get the following error message:
Error on LFS Pull git: 'lfs' is not a git command. See 'git --help'. The most similar command is log
In the Gitkraken documentation (here) we find the following explanation:
Note: If GitKraken still cannot find Git or Git LFS, the terminal or CMD may be using a different path than the system or user path. For example, on OSX applications launched from the GUI have a different path than those launched from the terminal.
To check this, we can do the following command: which git-lfs
and which git
Indeed, I get the following result:
...ANSWER
Answered 2021-Mar-30 at 00:59Your PATH
setting needs to refer only to directories, not to files. So if the git-lfs
binary is in /opt/homebrew/bin
, then you'd want to do this:
QUESTION
I am new to git/GitHub and am trying to understand and emulate the typical workflow and have run into conflicting advice.
The guidelines for the FirstContributions repository suggest that the typical workflow should be:
fork -> clone -> edit -> pull request
However, the guidelines for the another repository for beginners state the following:
Always clone from the main repository and add your fork as a remote.
Please help me understand the merits of each approach. Which one should I be using?
...ANSWER
Answered 2021-Mar-21 at 19:00In general you will want to have the original repository available as a remote on your local repository. Whether you clone from the main repository and then add your fork as a remote or do it the other way around doesn't really matter.
The reason you want the original repository available is so that when you make changes in the future, you can base them on the current state of the remote repository, rather than on the state of the remote repository at the time you created your fork.
If you use the official gh
CLI (available from https://github.com/cli/cli/releases/), this is as simple as:
git clone
cd working_directory
gh repo fork --remote
This will (a) fork the repository on github, and then (b) configure two remotes in your local directory:
origin
points to your fork, andupstream
points to the original repository
When you start working on a new pull request, first update the state of the upstream repository:
QUESTION
OS: Ubuntu 19.10
git: 2.20.1
I just spend a lot of time writing up some documentation. I saved the markdown
file in my documentation site's project folder as: content/topics/workflow/docker/git-workflow.md
ANSWER
Answered 2020-Apr-09 at 18:43I was able to locate the file thanks to this answer and the following commands:
QUESTION
I have a ~/scripts/git-workflow.sh
file that looks like:
ANSWER
Answered 2019-Dec-10 at 18:45zsh
doesn't perform word-splitting on parameter expansions by default, so git
and pull
aren't two separate words in the desired command. While you can enable it on a particular parameter expansion, a better approach is to just use an array.
QUESTION
I've been searching around to find out what others do in this situation but I'm having trouble finding a definitive answer.
Our current workflow is as follows (btw, we use Azure DevOps for our GIT repository):
- We have a remote 'Development' branch
- A dev creates a new branch from remote/Development (e.g. remote/FeatureA)
- A local copy of FeatureA is created
- Work is done locally and committed to the local/FeatureA branch
- As a side note, if changes are merged into remote/Development ...
- We pull those changes into local/Development
- Perform a rebase of local/FeatureA onto local/Development
- As a side note, if changes are merged into remote/Development ...
- Once local/FeatureA is done, it is pushed to remote/FeatureA
- A pull request is raised to merge remote/FeatureA into remote/Development
However, any commits done locally (e.g. local/FeatureA) are not backed up in anyway and there is the potential to lose those changes if the workstation dies for whatever reason. I was thinking it might be possible to push those commits to the remote branch (remote/FeatureA) so they are always backed up in the cloud (similar to the requirements of this poster ... Git workflow and rebase vs merge questions). But it appears that doing this would cause grief in rebasing should any changes be made to remote/Development by another developer.
Does anyone have a good solution for this? That is, how can I ensure my code changes/commits are backed up while continuing to work on a Feature before it is ready to be merged into the remote/Development branch? I supposed I could look at a hardware solution ... e.g. connect a portable HDD to my workstation and have scheduled backups ... but I thought there might be a more elegant solution.
...ANSWER
Answered 2019-Nov-12 at 23:45You indeed can backup your feature branches to the remote repo, and it is good practice to do so.
So what happens if remote/Development
is changed and you have to rebase your feature branch?
You do as usual for the local part (pulling the new changes on Development
then rebasing your feature on it), and yes, at this point, the remote backup is "outdated" by the rebase. But since you're not disrupting anyone else's work (or so I guessed from your description?) on this branch, you can then push --force
the result of your rebased local feature branch.
I think you slightly misunderstood the part about
"But it appears that doing this would cause grief in rebasing should any changes be made to remote/Development by another developer"
...which is true for shared stable branches like your Development
here, but not for unshared (until they're eventually merged via a PR, of course) feature branches.
(Anecdotically, we happen to have a very similar workflow in the team I'm in at the moment.)
QUESTION
I am learning git/github/version control and I found the diagram below really useful (source). My question is where does git merge
fit into this diagram? Where would the arrow start and point to?
ANSWER
Answered 2019-Aug-19 at 16:32As I commented, "rebase
" here is in the context of a git pull --rebase
:
- fetch from the remote repository
- rebase on top of the remote tracking branch which just got updated by the fetch.
A git merge
would be between local repository and workspace:
- local repository has the source of the merge: what you are merging from,
- workspace is your working tree, where you have checked out your current working branch: it is what you want to merge to.
You need a workspace in order to resolve possible merge conflicts.
While Schwern's answer is technically correct, it is confusing.
- yes, there are some edge cases (as seen here or there) where you could merge without involving a working tree.
- but a working tree is (almost always) involved when merging
The intent of the diagram is to show you where to look after a git
command execution.
From "True Merge"
A merged version reconciling the changes from all branches to be merged is committed, and your HEAD, index, and working tree are updated to it.
It is possible to have modifications in the working tree as long as they do not overlap; the update will preserve them.
If you were to do a git merge
in a bare repository (no working tree), you would get:
QUESTION
update1:
right now I am facing conflicts when I do rebase. after I modify the code. Can you let me know what command to execute to remove the conflicts. Providing the status below
...ANSWER
Answered 2019-May-18 at 06:40From the branch A I created a new local branch B.
QUESTION
Our team seems to be running into this problem over and over again. When we start on a project we create an integration branch from the master
and call it stable
. Now, each individual developer branches out from stable
and once they are done, they create a pull request to the stable
and do a squash and merge before closing it.
The problem happens when we want to merge
stable
back to master
. We usually rebase
on top of master
but this leads to many conflicts since 2 months down the line master
has a lot more commits than when we branched from.
I read some posts like - Git Workflows: Rebasing Published/Shared Branches and some of them seem to advocate merging master
to stable
from time to time before doing the final rebase
of stable
on top of master
at the time of creating a pull request and then there was one What is the right git workflow with shared feature branches? which said that back merge from master
to stable
is a bad idea.
My question is - Is merging master
to stable
from time-to-time the ideal solution here to prevent the rebase
conflict hell which we go through every time or are there any better solutions out there? If this was already answered please let me know.
We can't merge
stable
to master
sooner because master
requires the latest and greatest end-to-end functional production ready code.
ANSWER
Answered 2019-Feb-13 at 06:03Is merging master to stable from time-to-time the ideal solution here to prevent the rebase conflict hell which we go through every time or are there any better solutions out there?
In your particular workflow, where master is actively modified while stable is updated... yes, even though it is not a best practice.
Ideally, master should not evolve much while your integration branch (stable) is updated.
An example of such workflow: gitworkflow, which uses a "next" branch as integration, but will then remerge the feature branch themselves directly to master (which has not change much since the last release)
QUESTION
I have the following git
workflow:
ANSWER
Answered 2018-Oct-01 at 11:45You've got two general choices.
The first, and one I normally adopt, is to rebase your version of the develop
on top of the remote version of develop
. If there are merge conflicts, you can resolve them as you go (i.e. rebase --continue
when done).
QUESTION
I follow the generic OSS structure:
- the OSS' remote repository hosted on GitHub
- a fork of the OSS remote repository to my own remote repository
- a clone of the fork on my remote repository to create a local repository
Thus, a contributor would create a new branch locally, push the changes to his/her remote repository, and then open a pull request to the OSS' remote repository.
This has been working well. However, the main issue comes when I try to review another contributor's pull request by fiddling with it locally.
So I have fetched a pull request made to the OSS' remote repository using this command:
git fetch upstream pull//head:
followed by git checkout
and it was successful. I played around with the PR, and reviewed it on GitHub. Then, the contributor updated the PR by pushing new commits to their branch (on their remote repo), which was automatically reflected in the PR.
Now, I want to be able to get the updates locally so that I can try the changes again. I understand that my copy of the PR branch does not track the remote branch by default, so I tried to set it to track the PR:
git branch --set-upstream upstream/pull//head:
like how I have done when I first fetched the branch. However, I got the response that
error: the requested upstream branch 'pull//head:' does not exist
I tried again with:
git branch --set-upstream-to upstream/pull//head:
which also failed with the same error.
Then, I thought, is it because a PR is like a 'reflection' of the branch on someone's remote repository, so if I want to track an upstream branch I should track from the person's remote repository?
So I added the contributors' remote repository as a remote, and tried again:
git branch --set-upstream-to
and I still faced the same error.
I did some Googling, and I found this, but I do not want to get all the pull requests. I also found links like this one but nope, not the help that I need there.
Can anyone point out what is wrong with the way that I am doing things now? Thanks!
Edit: Is there an easier way to do things aside from what has been proposed by Marina Liu - MSFT below?
...ANSWER
Answered 2018-Apr-11 at 06:38The problem—or at least the first one—here is that you cannot use an upstream to refer to a GitHub pull request reference.
In Git, an upstream on a branch consists of two parts:
- The name of a remote, such as
origin
- The name of a branch on that remote, such as
master
Git puts these two together to get refs/heads/master
—this is the name on the remote—then runs this string through the fetch
setting(s) for the remote. The standard fetch
setting for the remote named origin
is +refs/heads/*:refs/remotes/origin/*
, so if the upstream is currently set to the pair <origin
, master
>, the name that Git looks up in your own repository is refs/remotes/origin/master
, which is your remote-tracking name for their master
.
Note the assumption in here that the name on the remote begins with refs/heads/
.
The actual name of a pull reference on GitHub begins with refs/pull/
, not refs/heads/
, so that the full name of the commit you want for pull request #123 is refs/pull/123/head
. There is no way to spell this that starts with refs/heads/
because this is not a branch name.
Now, you can—as suggested in your first link—add an extra fetch
setting:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install git-workflow
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page