sitedi.blogg.se

Github desktop pull from another branch
Github desktop pull from another branch





github desktop pull from another branch

This shouldn't cause a delay since authors can approve their own PR. Instead, coauthors commit to their dev branch, and then submit Pull Requests (PRs) to have their changes pulled from their dev branches into master after (presumably cursory) review (mainly, ensuring the commit was intentional). Importantly, no one pushes/commits directly to the master branch. This single repo has a master branch, and it also has development branches for each collaborator. (The good news is people who like command line can go ahead and do command line and no one else will be the wiser.) This workflow is a simplified workflow from the one I usually advocate, to ensure it can be made to work with the less flexible GUIs.įor this workflow, the basic idea is there is only one repository and no forks. I'm accustomed to the command line approach myself, but that's a barrier to entry. But for now will just have to get by with my limited command line fu compared to these real computer programmers I work with more regularly.GitHub-Branching-Workflow GitHub-Branching-Workflowīelow I discuss a GitHub workflow suitable for currently available GUIs. Maybe one of these days I will entirely ditch the GUI behind. git commit -m 'Example only merging select files' And then here in the end I switch the active environment back to test. Then once that is done it is the usual to commit the updated files. and typing the files by hand, I just grab all the files that are different and check them all out together. So instead of typing git checkout test file1.txt file2.txt etc. This is advice taken from this blog, just a slicker way to grab all of the files that are different minus a few specific config files. Sixth line I then use xargs to pass git checkout from the test environment, and pass in all of my files (minus my two config files). The fifth sed line I wrap the files in quotes (if you have a file that has a space it will cause problems otherwise). You could also do grep -v 'file1.txt|file2.txt' |, but in this case this was giving me fits (maybe due to the forward slash not being escaped the right way for grep?). Third/Fourth lines I use grep to get rid of my specific config files out of that resulting list of files. Second I grab all the files that are different using git diff branch1 branch2, and only print out the file names. The first line git switch is pretty self explanatory – I switch to the master branch (I will typically be doing work on test).

github desktop pull from another branch

So here is the particular logic I put together, piping a bunch of commands together: git switch master But in the end I want to keep those two files different between the branches, and not merge this config file (along with the other config file). So you can see that the test branch version (in red) and the master branch version (in green), just have a minor difference. If we do git diff master test - special_config1, we can see the more specific differences between those two config files: Two config files and three different text files. So you can see that I have 5 different files in total. Via the git bash shell, if you navigate to your repository and do git diff master test -name-only, it shows you the different files in the two branches: So just for illustration I added a test branch to my Blog_Code repository, and then some junk files just to illustrate. So here are my notes on how I solved the issue. I also need an entire command line solution for when I am working on a remote headerless machine with no GUI as well anyway. You can use the GUI to make a pull request, but when accepting the pull request in the browser I think it is all or nothing. I often use the GitHub desktop GUI to commit changes (when working on my local laptop). (If I edit them I will need to make sure to edit both master & test branches in the end.)

github desktop pull from another branch

Note I did not want these files ignored, just not merged between branches. So I had particular config files with essentially different SQLAlchemy connection strings, but nothing else. My particular use case was I had a test branch that needed to only interact with a test database, and the master branch needed to talk to the prod database. The other day at work I had a mildly annoying problem – merging only selected files between a test and production branch in github.







Github desktop pull from another branch