Most Popular
1500 questions
3544
votes
24 answers
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 Overflow on how to track a newly created remote branch.
However, my workflow is slightly different. First I want to create a local branch, and I…
Jesper Rønn-Jensen
- 99,159
- 42
- 115
- 151
3541
votes
24 answers
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 got as far as:
git log -- [filename]
which shows me the commit history of the file, but how do I get at the content of each of the file…
Richard
- 36,488
- 6
- 28
- 27
3539
votes
32 answers
Stash only one file out of multiple files that have changed with Git?
How can I stash only one of the multiple changed files on my branch?
Rachel
- 96,555
- 116
- 263
- 364
3537
votes
51 answers
3524
votes
12 answers
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 the log files from my repository.
git rm mylogfile.log
will remove a file from the repository, but will also remove it from the local file…
mveerman
- 36,113
- 3
- 20
- 14
3513
votes
77 answers
How do I correctly clone a JavaScript object?
I have an object x. I'd like to copy it as object y, such that changes to y do not modify x. I realized that copying objects derived from built-in JavaScript objects will result in extra, unwanted properties. This isn't a problem, since I'm copying…
soundly_typed
- 37,147
- 5
- 27
- 36
3504
votes
6 answers
Catch multiple exceptions in one line (except block)
I know that I can do:
try:
# do something that may fail
except:
# do this if ANYTHING goes wrong
I can also do this:
try:
# do something that may fail
except IDontLikeYouException:
# say please
except YouAreTooShortException:
#…
inspectorG4dget
- 104,525
- 25
- 135
- 234
3497
votes
28 answers
How do I POST JSON data with cURL?
I use Ubuntu and installed cURL on it. I want to test my Spring REST application with cURL. I wrote my POST code at the Java side. However, I want to test it with cURL. I am trying to post a JSON data. Example data is like…
kamaci
- 69,365
- 67
- 217
- 352
3496
votes
29 answers
What is the difference between public, protected, package-private and private in Java?
In Java, are there clear rules on when to use each of access modifiers, namely the default (package private), public, protected and private, while making class and interface and dealing with inheritance?
intrepion
- 36,509
- 4
- 22
- 21
3487
votes
77 answers
Why is the Android emulator so slow? How can we speed up the Android emulator?
I have got a 2.67 GHz Celeron processor, and 1.21 GB of RAM on a x86 Windows XP Professional machine.
My understanding is that the Android Emulator should start fairly quickly on such a machine, but for me, it doesn't. I have followed all the…
Andrie
- 3,451
- 3
- 15
- 3
3478
votes
26 answers
Get the current URL with JavaScript?
All I want is to get the website URL. Not the URL as taken from a link. On the page loading I need to be able to grab the full, current URL of the website and set it as a variable to do with as I please.
dougoftheabaci
3467
votes
46 answers
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 working files point to this branch".
But with Git I'm not sure when I am editing a file in NetBeans or Notepad++, whether it's tied to the master or…
mike628
- 41,385
- 17
- 39
- 53
3467
votes
21 answers
How do I list all files of a directory?
How can I list all files of a directory in Python and add them to a list?
duhhunjonn
- 43,885
- 11
- 26
- 15
3458
votes
33 answers
When to use LinkedList over ArrayList in Java?
I've always been one to simply use:
List names = new ArrayList<>();
I use the interface as the type name for portability, so that when I ask questions such as this, I can rework my code.
When should LinkedList be used over ArrayList and…
sdellysse
- 37,748
- 9
- 24
- 24
3447
votes
38 answers
What is dependency injection?
There have been several questions already posted with specific questions about dependency injection, such as when to use it and what frameworks are there for it. However,
What is dependency injection and when/why should or shouldn't it be used?
AR.
- 38,147
- 9
- 42
- 52