Tag: git

58 votes
29 answers
3.1K views
How do I make Git use the editor of my choice for commits?

I would prefer to write my commit messages in Vim, but it is opening them in Emacs. How do I configure Git to

avatar
Hallie
0 1 0 9
asked 07 September, 2021
57 votes
29 answers
2.4K views
How to find and restore a deleted file in a Git repository

Say I'm in a Git repository. I delete a file and commit that change. I continue working and make some mor

avatar
Hilario
0 1 0 9
asked 07 September, 2021
66 votes
25 answers
1.7K views
Commit only part of a file in Git

When I make changes to a file in Git, how can I commit only some of the changes? For example, how could I com

avatar
Dusty
0 1 0 9
asked 07 September, 2021
54 votes
28 answers
2.2K views
How do I list all of the files in a commit?

I am looking for a simple Git command that provides a nicely formatted list of all files that were part of the

avatar
Jesenia
0 1 0 9
asked 07 September, 2021
48 votes
30 answers
512 views
How to get the current branch name in Git?

I'm from a Subversion background and, when I had a branch, I knew what I was working on with "These worki

avatar
Santiago
0 1 0 9
asked 07 September, 2021
54 votes
12 answers
3K views
Difference between "git add -A" and "git add ."

The command git add [--all|-A] appears to be identical to git add .. Is this correct? If not, how do they diff

avatar
Nidia
0 1 0 9
asked 07 September, 2021
50 votes
30 answers
2K views
Message 'src refspec master does not match any' when pushing commits in Git

I clone my repository with: git clone ssh://xxxxx/xx.git But after I change some files and add and commit

avatar
Luis
0 1 0 9
asked 07 September, 2021
64 votes
12 answers
1.8K views
Remove a file from a Git repository without deleting it from the local filesystem

My initial commit contained some log files. I've added *log to my .gitignore, and now I want to remove th

avatar
Benton
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
2.2K views
Stash only one file out of multiple files that have changed with Git?

How can I stash only one of multiple changed files on my branch?

avatar
Wilber
0 1 0 9
asked 07 September, 2021
54 votes
24 answers
2.5K views
View the change history of a file using Git versioning

How can I view the change history of an individual file in Git, complete details with what has changed? I have

avatar
Alba
0 1 0 9
asked 07 September, 2021
58 votes
24 answers
515 views
How do you create a remote Git branch?

I created a local branch which I want to 'push' upstream. There is a similar question here on Stack

avatar
Rudy
0 1 0 9
asked 07 September, 2021
59 votes
9 answers
542 views
Move existing, uncommitted work to a new branch in Git

I started some work on a new feature and after coding for a bit, I decided this feature should be on its own b

avatar
Chelsea
0 1 0 9
asked 07 September, 2021
57 votes
7 answers
2.4K views
How do I clone a specific Git branch?

Git clone will behave copying remote current working branch into local. Is there any way to clone a

avatar
Tuan
0 1 0 9
asked 07 September, 2021
54 votes
19 answers
471 views
Undoing a git rebase

Does anybody know how to easily undo a git rebase? The only way that comes to mind is to go at it manually:

avatar
Shantay
0 1 0 9
asked 07 September, 2021
53 votes
30 answers
3K views
Delete commits from a branch in Git

I would like to know how to delete a commit. By delete, I mean it is as if I didn't make that commit, an

avatar
Don
0 1 0 9
asked 07 September, 2021
58 votes
22 answers
3K views
Make an existing Git branch track a remote branch?

I know how to make a new branch that tracks remote branches, but how do I make an existing branch track a remo

avatar
Sena
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
954 views
How do I remove a submodule?

How do I remove a Git submodule? By the way, is there a reason I can't simply do git submodule rm whate

avatar
Elicia
0 1 0 9
asked 07 September, 2021
59 votes
25 answers
2.6K views
How to delete a remote tag?

How do you delete a Git tag that has already been pushed?

avatar
Bryan
0 1 0 9
asked 07 September, 2021
54 votes
30 answers
684 views
How do I update or sync a forked repository on GitHub?

I forked a project, applied several fixes and created a pull request which was accepted. A few days later, ano

avatar
Wei
0 1 0 9
asked 07 September, 2021
57 votes
30 answers
953 views
Squash my last X commits together using Git

How can I squash my last X commits together into one commit using Git?

avatar
Tana
0 1 0 9
asked 07 September, 2021