Tag: git branch

How return previous stage after using git reset –hard?

I have 2 local branches: master and another_branch. This branches have few commits on server. My tracked branch: another_branch. I use git reset –hard and current branch loses all current local commits. But on server all is no different. How do I can return previous stage before using hard reset?

If a git pull request is still pending, how do I continue working across branches?

FYI – I’m a relative amateur with git, having used it for a couple of years but only on a very basic level. This is probably a beginner-level question. I’m collaborating on a git repo. I created a topic branch named foo, made changes, committed, pushed, and sent a pull request for my other collaborators […]

Merge commits where all parents are from the same branch are not allowed

I am having 3 branches i.e, develop, feature, xyz. Right now I am working in xyz branch and commit here. Then i have followed these steps git checkout feature git merge xyz — Here it copied that commit and created one more commit as “merge: prev_commit latest_commit”. So in feature i have 2 new commits […]

git : switching to different branch without commiting the changes of the branch

I have created on branch named as “sub-branch”. I am creating on file test1.txt after switching to sub-brnach using command git checkout sub-branch. Now when i switch to master branch using command git checkout master without committing the changes of the sub-branch, the file test1.txt is also shown in master branch. Why the file test1.txt […]

How do I create a branch without cloning?

I’d like to automate the creation of feature branches that match in multiple projects. I can script this but to speed things up it would be nice if I could just tell the remote repo to create the branch, without cloning the entire source code. Is this possible?

Allow all developers to only do merge requests to master

I wish to do the following: Nobody can push directly to master, any attempt would get rejected. Merge Requests can be made by anyone but not approved by anyone, just admins. Essentially, master is something I want nobody to be able to push to directly, only via pull requests, which only the administrators can approve. […]

Git branch maintenance

I would like to know how to create git branches as below: –> I have a master branch –> I want to create branch1, make some changes and will push later. –> on same master branch i want to create another branch, branch 2 for some other changes. my problem is i want to use […]

git get the horizontal line in git command

I just add some new files, modifies, one folder in my git repo, I use git branch to display my local git repository, I get below results: $ git branch – dev_game_v3 * master what’s the meaning of the horizontal line? any error here about my repo?

How to have git setup tracking branch on pull

There are times when I’m pulling new changes from a repo that someone else changed. They have created new branches and pushed them to the central repo. Is there a way, when pulling these new branches, to get git to automatically create tracking branches of the same name locally?

Why is my local Git branch detached?

This question already has an answer here: Why does Git tell me “Not currently on any branch” after I run “git checkout origin/<branch>”? 1 answer

Git Baby is a git and github fan, let's start git clone.