git-branch

git checkout to a branch takes long time

…衆ロ難τιáo~ 提交于 2019-12-08 06:15:32
问题 I am on Ubuntu 17.10 and I am using git (version 2.14.1). Whenever I create a branch from master and try to checkout to it (or to the master from it), it takes a whole lot of time, around few minutes, sometimes nearly 10 minutes. True, that I have a few GBs of data, but as far as I understand, the whole data doesn't actually get copied and instead only the changes are saved. What then could be the issue behind this? 回答1: While Git 2.20 and 2.21 improve git checkout performance (see next

Git push local master to remote specific branch [duplicate]

血红的双手。 提交于 2019-12-08 06:09:06
问题 This question already has answers here : Push local master commits to remote branch (2 answers) Closed 2 years ago . I did changes in my local branch. Then I checkout to my master branch and merge it with my local branch. Now I want to push the changes in the master branch to specific branch at the remote. Say, we are 5 Developers. Each one having their own branch at remote repo. If I modified something at my local repo, I should push my work on the branch which is named in my name. How can I

Git remote branch got deleted, how to resync local changes with new branch

…衆ロ難τιáo~ 提交于 2019-12-08 05:59:43
问题 I got a remote branch as develop_1 which I was using. All my local code changes were committed to it but my lead has accidentally deleted that remote branch. I have all those code changes in my local system. Now I want to push all those changes back to that same Git repository in a new remote branch, say develop_2 . How can I create a new branch, sync my local changes and push it to remote? 回答1: Within your local branch develop_1 you could simply create the new branch: $ git checkout -b

Is there a difference between these two ways of moving a branch?

有些话、适合烂在心里 提交于 2019-12-08 04:40:56
问题 I was following the interactive LearnGitBranching tutorial and came across two ways of moving around a branch. I want to be sure that I am not missing anything. Is there a difference between: git branch -f master master^ and, supposing HEAD points to master , git reset HEAD^ And, if they do the same thing, why have the reset command at all? Would it mean it's simply a shorthand for git branch -f ? Thank you kindly! 回答1: As genisage noted in a comment, git reset has multiple modes. Ignoring

Difference between creating a branch and doing a soft reset? Best way to go back to an old working version?

守給你的承諾、 提交于 2019-12-08 04:32:16
问题 Say the history of my commits is A - B - C and I have only this branch. B was fully working. I started adding some functionality in C, but it's not working so I need to go back to B, but I also want to retain the code I wrote in C because I will want to review it and fix it later. What is the best way to do it? Is the best way to create a new branch starting from B? What is the difference between that and doing a soft reset? I understand a soft reset doesn't delete the changes (is that

Git: how to change active branch on remote repository?

这一生的挚爱 提交于 2019-12-08 02:05:24
问题 I worked on some code on a local branch and then I pushed it to a remote test repository with this command: git push origin fix_vouchers:fix_vouchers I'd like to change the active branch on that remote repository so that the other developers can test this code. Can I do this from my local environment? 回答1: If the remote repository is just a sharing point, a bare repository, you'd be better off just communicating the branch having the code to the other developers. In a later comment you

Can git figure out that the branch to be merged has obsolete changes?

别说谁变了你拦得住时间么 提交于 2019-12-08 01:39:26
问题 I am new in git and I am find it hard to wrap my head around the fact that everything is around snapshots/commits and not individual files. So assume that I have a tree in my repository as follows. C4 (HEAD,Master,Origin/Master) * C3 * C2 * C1 Now I branch out from here: B1 (HEAD, testBranch) * C4 (HEAD,Master,Origin/Master) * C3 * C2 * C1 In my testBranch I only modify 2 files of the whole repository. Just 2. The development in master in the remote repository continues so eventually we have

How to find out what files were changed in a git branch (not the difference between two branches)

匆匆过客 提交于 2019-12-08 00:20:49
问题 I have a branch named feature_219 which was created from master a little while ago. Since the diversion, there were a number of files changed on both the branches. Now I am trying to figure out what files where changed while working on the feature_219 branch only. After doing some research I found out that git diff --name-only master feature_219 might help but it turned out that this commands tells about all files that are different in both the branches. I tried to look for some option with

Proper version control workflow for a mixture of repositories

久未见 提交于 2019-12-07 14:04:31
Would appreciate your feedback on the following (I'm a Git beginner). I have a public repo on GitHub for my dissertation study's artifacts (mostly software, written in R ). I'd like to adapt a third-party GitHub repo, containing LaTeX dissertation template (basically, I want to periodically sync with it, merging changes, which I want/need). I've created corresponding submodule for the manuscript within my main project directory structure. However, now I questioning whether this route is the best (optimal). My questions : 1) What is the proper workflow for the above-mentioned task? 2) Would is

Git pull reverted commits in master?

谁说胖子不能爱 提交于 2019-12-07 10:21:36
问题 A colleague, whom we'll call Aaron, was assigned to renovate a section of a website as a long-term project. He created a new Git branch, called aaron . All his changes were made on this branch. While he was working, I continued to maintain the site as a whole, committing my changes to master . Eventually, Aaron merged his branch into master . This somehow reverted all of the commits I'd made to master between the time of the merge and the time when the aaron branch was first created. If I