Linked Questions
17 questions linked to/from Move branch pointer to different commit without checkout
394
votes
4
answers
330k
views
How do I make a branch point at a specific commit? [duplicate]
In Git, I understand that a branch is a pointer to a commit.
How do I make a specific branch point to a specific commit? Say I want to make master point at 1258f0d0aae..., how do I do that?
0
votes
1
answer
81
views
How to make branch master point to commits on branch escaped? [duplicate]
I have a couple of branches (master, escaped), now, branch escaped has some commits that
branch master doesn't have. What I want to do is to have branch master point at those commits on branch escaped ...
0
votes
0
answers
28
views
How can I replace the code inside my master with another branch [duplicate]
I have a project at work in which I worked on different branches for features and for different reasons the current branch that should be deployed is too different from master. I think merging it will ...
118
votes
6
answers
35k
views
Is there some kind of 'git rebase --dry-run', which would notify me of conflicts in advance?
I'm trying to script rebasing and my script will take different paths depending on if the rebase results in any conflicts.
Is there a way to determine if a rebase would result in conflicts before ...
17
votes
5
answers
20k
views
Git - Make local HEAD the new master
I decided to go back a few commits because the path I followed was wrong. So I checked out Added cordova to .gitignore commit, and made some modifications. Like illustrated below :
Now when I push ...
11
votes
2
answers
12k
views
How do you sync existing code existing repository using git
Here's my situation:
I have an existing git repository
I have code on an active staging server that has been manually kept in sync with what's in the repository, but is not currently under version ...
18
votes
1
answer
4k
views
Difference between `git branch -f <branch_name> <hash>` and `git checkout <branch_name>; git reset --hard <hash>` under a clean working tree?
Up until now, I have always used git checkout <branch_name>; git reset --hard <hash> to move a branch back to an earlier commit.
Then I came across this question, but the answers and ...
2
votes
2
answers
959
views
git rebase to master two feature branches on top of each other
I have situation like this:
H---I---J feature2
/
E---F---G feature1
/
...
2
votes
2
answers
1k
views
Use SourceTree to move git branch pointer for non-active branches
I've found this question on moving branch pointers without doing a checkout. Basically I want to know how to do exactly that, in SourceTree.
So for example, suppose I'm on a local branch feat/foo. I'...
-1
votes
2
answers
562
views
GIT - Replace a branch content with another
I have the following branches in my local git:
-master
-develop
-test
I am adding a new feature, using the test branch, which was created months ago. I need to update its content (replace everything) ...
1
vote
1
answer
183
views
Move commits from linear history to a separate branch
This is not the same as Split a git branch into two branches? and not How to move certain commits to another branch in git?
I have linear B---C history branched from Master:
Master ---A
\
...
1
vote
2
answers
93
views
How do you undo committing to a branch that's behind?
My coworker got himself into some trouble yesterday. He moved master about 100 commits behind origin/master (I'm not sure how he did that, probably with this), then he committed. The result was that ...
0
votes
1
answer
114
views
Get previous project version
My git log was showing several project commits in my projects. I'm using only master branch. I have done git checkout to first commit. I was expecting that my directory will be changed to state when ...
0
votes
3
answers
102
views
Remove directory from Git repo
I have a local Git repo which I have been working on. The project has a master and dev branch. My changes are all within the dev branch at the moment.
Problem is I accidentally dropped 2 folders ...
2
votes
1
answer
58
views
Prepend a commit from master to a branch
I started working on a new feature on master, by creating a commit A:
o -- A (master)
before realizing that I should probably create a new branch. However, I didn't "move" the commit A to the new ...