git-branch

Benefits of using git branches vs. multiple repositories

元气小坏坏 提交于 2019-12-05 00:28:17
We are doing development for automation code. Our code automates the company's products and is synced to a particular product version. Currently, we have 1 big Git repository with multiple branches in it - v1.0, v1.1, v2.0 (automation for version 1.0 goes in v1.0 branch, and so on). What are the advantages and disadvantages of having these in a single repository with branches vs. keeping each version code in a separate repository ? Both solutions can work, the answer i'm looking for is a list of pros/cons for either approach. I know that many teams are using branches to isolate temporary

How can I programmatically detect inactive branches in GitHub repositories?

女生的网名这么多〃 提交于 2019-12-05 00:26:50
问题 I have a dozen repositories in the GitHub repository. The repository structure looks like below: + project1 +------- trunk +------- tags +------- branches + ------- releases + project2 .... Our policy requires any active branch to be deleted after 30 days of inactivity. However, there is no automatic way of detecting such an inactive branch. Occasionally, I have some inactive branch that survive past the 30-day mark. Is there a script to list branches, as well as their last commit date in all

How do I determine the source branch of a particular branch?

爷,独闯天下 提交于 2019-12-04 23:37:23
I have a branch in git and want to figure out from what branch it originally was branched and at what commit. Github seems to know, since when you do a pull request it usually automatically sets up what branch it should go into, but I can't figure out how to do this manually from the command line. Let me add a concrete example: master -- ongoing development 2.2 -- stable maintenance A feature branch feature was created (at commit B below) and worked on ( B' , C' & E' ) and merged against the source branch to pick up C and D feature branch: B'-C'-C--D--E' / / source branch: A--B--C--D--E-- ...

How to git rebase -i for a range of commits?

帅比萌擦擦* 提交于 2019-12-04 22:19:37
Can I squash a range of commits for a local feature/topic branch using rebase that does not include the most recent commit? This is for commits that I want to prepare before they get merged and pushed to a public repo. I was working quickly and made a bunch of minor changes with poor titles and descriptions that I want to squash into two or three separate logical commits with a great comments. Can I select a range of commits between 329aed9 and af39283 that could be at any point in this feature branch's short history? git rebase -i RANGE_START_COMMIT_ID RANGE_LAST_COMMIT_ID Thanks! You could

How to keep branches in sync when using Git Flow

試著忘記壹切 提交于 2019-12-04 20:15:48
This is the workflow we currently follow: Finish a feature and merge it into develop branch Create a release branch from develop Run build scripts on release branch Create a pull request to merge the release branch into master Accept the release branch pull request and merge The master branch can then deploy to live server by running deploy command This all works great, except in my Git repo my branches are out of sync master is now behind develop because it doesn't have the merge commits that happened from the pull request merging the release branch into develop . But master is also ahead of

Deploy git branches

▼魔方 西西 提交于 2019-12-04 20:03:32
After struggling with and sorting out a workflow for web development with git, I've been tasked with adding in a staging server at the last second. We develop/test locally and push out to a repo, and now there needs to be a sandbox in between so people in other departments can play around and try out new things without breaking stuff. Remote repo needs two long-running branches (in the spirit of nvie's branching model), master and develop. We need to be able to push to one repo, and checkout the develop branch to test.site.com docroot, and when ready, merge develop into master and checkout

Get commit where merged branch forked from (with intermediate merge)

蓝咒 提交于 2019-12-04 18:43:54
Lets use the latest available git 2.16.2 and tig 2.3.3. cd /tmp && mkdir fit && cd fit git init touch m1 && git add m1 && git commit -m "master 1" touch m2 && git add m2 && git commit -m "master 2" git checkout -b develop touch d1 && git add d1 && git commit -m "develop 1" git checkout master touch m3 && git add m3 && git commit -m "master 3" git checkout develop git merge master --no-edit touch d2 && git add d2 && git commit -m "develop 2" touch d3 && git add d3 && git commit -m "develop 3" git checkout master git merge develop --no-edit touch m4 && git add m4 && git commit -m "master 4" git

Find the git branch or branches from commit id

无人久伴 提交于 2019-12-04 18:40:11
问题 Actually am try to get a report on merge conflicts. I used 'git blame' to see who has changed what line, but i couldn't find the branch and repository name information. Is there a way to find the repository name, branch name and author name of a file from 'git blame' or from commit ids' so that whenever a merge conflict occurs i can send an email to the authors who have touched that file/lines to resolve it. 回答1: git blame should only give you the revision and author, but: as mentioned in

git status on master and branches

半世苍凉 提交于 2019-12-04 18:13:21
I made few local changes in the master in git repository and released I have to create a new branch. I created a new branch and committed the changes using git checkout -b changes git add <files> git commit -m "new feature in branch" The name of modified file is "run.pl". Before the new branch, git status on master was On branch master Changes not staged for commit modified run.pl Untracked files build1.pl After the new branch, git status in master is On branch master Untracked files build1.pl I could not understand how git status on master can change when I committed the changes only to a

Merge changes from one repo to another with different tree structures

本秂侑毒 提交于 2019-12-04 17:37:16
问题 I have two Git repos, foo/master and bar/master: In foo: code_root ->dirA ->dirB -> *some files* In bar: code_root -> *same files as above* Now someone has made changes to *some files* ... how do I get those changes merged into *same files as above* ? When I say "merged" I mean I need the history (commit messages, log hashes etc.) of the deltas to come over as well. 回答1: You can split the changes out to the subtree level, and then merge with your other branch: # from your foo project git