Tag: git

54 votes
30 answers
2.1K views
Undo a Git merge that hasn't been pushed yet

Within my master branch, I did a git merge some-other-branch locally, but never pushed the changes to origin m

avatar
Omar
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
2K views
How to clone all remote branches in Git?

I have a master and a development branch, both pushed to GitHub. I've cloned, pulled, and fetched, but I

avatar
Percy
0 1 0 9
asked 07 September, 2021
54 votes
21 answers
2.5K views
Reset local repository branch to be just like remote repository HEAD

How do I reset my local branch to be just like the branch on the remote repository? I did: git reset --hard

avatar
Stacia
0 1 0 9
asked 07 September, 2021
55 votes
26 answers
2.9K views
How can I determine the URL that a local Git repository was originally cloned from?

I pulled a project from GitHub a few days ago. I've since discovered that there are several forks on GitH

avatar
Roger
0 1 0 9
asked 07 September, 2021
62 votes
30 answers
1.7K views
How to change the URI (URL) for a remote Git repository?

I have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved "origin" to a NAS and succ

avatar
Leonardo
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
393 views
How can I add a blank directory to a Git repository?

How can I add a blank directory (that contains no files) to a Git repository?

avatar
Venice
0 1 0 9
asked 07 September, 2021
58 votes
16 answers
374 views
How do I push a new local branch to a remote Git repository and track it too?

I want to be able to do the following: Create a local branch based on some other (remote or local) branch (via

avatar
Roger
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
1.6K views
How can I reset or revert a file to a specific revision?

I have made some changes to a file which has been committed a few times as part of a group of files, but now w

avatar
Hallie
0 1 0 9
asked 07 September, 2021
56 votes
30 answers
1.1K views
How to resolve merge conflicts in a Git repository

I want to resolve merge conflicts in my Git repository. How can I do that?

avatar
Wilber
0 1 0 9
asked 07 September, 2021
53 votes
30 answers
1.1K views
How do I discard unstaged changes in Git?

How do I discard changes in my working copy that are not in the index?

avatar
Omar
0 1 0 9
asked 07 September, 2021
62 votes
15 answers
2.9K views
Move the most recent commit(s) to a new branch with Git

I'd like to move the last several commits I've committed to master to a new branch and take master b

avatar
Dwain
0 1 0 9
asked 07 September, 2021
64 votes
30 answers
338 views
How can I make Git "forget" about a file that was tracked, but is now in .gitignore?

There is a file that was being tracked by Git, but now the file is on the .gitignore list. However, that file

avatar
Hilario
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
2.1K views
How to remove local (untracked) files from the current Git working tree

How do you delete untracked local files from your current working tree?

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
57 votes
30 answers
1.1K views
How do I check out a remote Git branch?

Somebody pushed a branch called test with git push origin test to a shared repository. I can see the branch wi

avatar
Robt
0 1 0 9
asked 07 September, 2021
62 votes
30 answers
980 views
64 votes
27 answers
1.8K views
57 votes
30 answers
1.2K views
Git: How do I force "git pull" to overwrite local files?

How do I force an overwrite of local files on a git pull? The scenario is the following: A team member is mo

avatar
Carmelina
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
1.6K views
How do I rename a local Git branch?

I don't want to rename a remote branch, as described in Rename master branch for both local and remote Gi

avatar
Chelsea
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
2.5K views