Questions tagged [version-control]

Version control is the management of changes to documents, programs, and other information stored as computer files. Use this tag to mark general questions about usage and applicability of version control, VCS comparison. For most commands and techniques specific to each particular VCS there are specific tags, which should be preferred.

Version control, also known as revision control, source control or software configuration management (SCM), is the management of changes to documents, programs, and other information stored as computer files. It is most commonly used in software development, where a team of people may change the same files.

For questions specific to a certain version control software use the appropriate tag. Here is an (incomplete) list of commonly used tags:

17112 questions
25854
votes
105 answers

How do I undo the most recent local commits in Git?

I accidentally committed the wrong files to Git, but didn't push the commit to the server yet. How do I undo those commits from the local repository?
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241
20257
votes
41 answers

How do I delete a Git branch locally and remotely?

Failed Attempts to Delete a Remote Branch: $ git branch -d remotes/origin/bugfix error: branch 'remotes/origin/bugfix' not found. $ git branch -d origin/bugfix error: branch 'origin/bugfix' not found. $ git branch -rd origin/bugfix Deleted remote…
Matthew Rankin
  • 457,139
  • 39
  • 126
  • 163
13671
votes
37 answers

What is the difference between 'git pull' and 'git fetch'?

What are the differences between git pull and git fetch?
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
11359
votes
39 answers

How do I rename a local Git branch?

How do I rename a local branch which has not yet been pushed to a remote repository? Related: Rename master branch for both local and remote Git repositories How do I rename both a Git local and remote branch name?
Forrest
  • 122,703
  • 20
  • 73
  • 107
9414
votes
52 answers

How do I force "git pull" to overwrite local files?

How do I force an overwrite of local files on a git pull? My local repository contains a file of the same filename as on the server. error: Untracked working tree file 'example.txt' would be overwritten by merge
Jakub Troszok
  • 99,267
  • 11
  • 41
  • 53
6156
votes
41 answers

How do I discard unstaged changes in Git?

How do I discard changes in my working copy that are not in the index?
readonly
  • 343,444
  • 107
  • 203
  • 205
5639
votes
36 answers

How do I reset or revert a file to a specific revision?

How do I revert a modified file to its previous revision at a specific commit hash (which I determined via git log and git diff)?
Hates_
  • 66,613
  • 6
  • 32
  • 37
3154
votes
14 answers

I ran into a merge conflict. How do I abort the merge?

I used git pull and had a merge conflict: unmerged: some_file.txt You are in the middle of a conflicted merge. How do I abandon my changes to the file and keep only the pulled changes?
Gwyn Morfey
  • 32,741
  • 6
  • 25
  • 21
2974
votes
41 answers

How do I change the author and committer name/email for multiple commits?

How do I change the author for a range of commits?
2803
votes
21 answers

Ignore files that have already been committed to a Git repository

I have an already initialized Git repository that I added a .gitignore file to. How can I refresh the file index so the files I want ignored get ignored?
trobrock
  • 46,549
  • 11
  • 40
  • 46
2585
votes
51 answers

How do I delete all Git branches which have been merged?

How do I delete branches which have already been merged? Can I delete them all at once, instead of deleting each branch one-by-one?
Nyambaa
  • 38,988
  • 9
  • 29
  • 35
2386
votes
14 answers

Do I commit the package-lock.json file created by npm 5?

npm 5 was released today and one of the new features include deterministic installs with the creation of a package-lock.json file. Is this file supposed to be kept in source control? I'm assuming it's similar to yarn.lock and composer.lock, both of…
rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156
2309
votes
20 answers

When do you use Git rebase instead of Git merge?

When is it recommended to use Git rebase vs. Git merge? Do I still need to merge after a successful rebase?
Coocoo4Cocoa
  • 48,756
  • 50
  • 150
  • 175
2233
votes
26 answers

How can I see the changes in a Git commit?

When I do git diff COMMIT I see the changes between that commit and HEAD (as far as I know), but I would like to see the changes that were made by that single commit. I haven't found any obvious options on diff / log that will give me that output.
laktak
  • 57,064
  • 17
  • 134
  • 164
2028
votes
4 answers

How does Git handle symbolic links?

If I have a file or directory that is a symbolic link and I commit it to a Git repository, what happens to it? I would assume that it leaves it as a symbolic link until the file is deleted and then if you pull the file back from an old version it…
Alex
  • 34,776
  • 10
  • 53
  • 68
1
2 3
99 100