question stringlengths 11 28.2k | answer stringlengths 26 27.7k | tag stringclasses 130
values | question_id int64 935 78.4M | score int64 10 5.49k |
|---|---|---|---|---|
I've been banging my head on this issue for days now and have finally reached a brick wall.
I've been trying to get my stack to run:
http://django-websocket-redis.readthedocs.org/en/latest/running.html#django-with-websockets-for-redis-behind-nginx-using-uwsgi
I've been looking at some other SO articles like this one:
... | I found the issue.
My [runserver] socket (app.sock) should be pointed under upstream django and my [wsserver] socket (django.sock) should be pointed under location /ws/ like so:
upstream django {
server unix:/opt/django/app.sock;
}
server {
listen 80 default_server;
charset utf-8;
client_max_body_size ... | Redis | 30,470,448 | 22 |
I'm using the redis-cli tool to observe redis-server latency. Here's an example:
ubuntu:~$ redis-cli --latency -h 127.0.0.1 -p 6379
min: 0, max: 15, avg: 0.12 (2839 samples)
Question is, what these values actually mean? I'm struggling to find documentation on this beyond what's available through the tool's own help do... | The redis-cli --latency -h -p command is a tool that helps troubleshoot and understand latency problems you maybe experiencing with Redis. It does so by measuring the time for the Redis server to respond to the Redis PING command in milliseconds.
In this context latency is the maximum delay between the time a client
... | Redis | 27,735,411 | 22 |
How do I install and configure Redis on AWS ElasticBeanstalk? Does anyone know how to write an .ebextension script to accomplish that?
| The accepted answer is great if you are using ElastiCache (like RDS, but for Memcached or Redis). But, if what you are trying to do is tell EB to provision Redis into the EC2 instance in which it spins up your app, you want a different config file, something like this gist:
packages:
yum:
gcc-c++: []
make: ... | Redis | 26,528,395 | 22 |
I installed Stack Exchange redis client in C#.
I can only delete one key or array of keys but I don't know how to delete keys with prefix.
Or another solution can be first get all keys by pattern and then delete them. But I don't know how to get keys by pattern too.
| You can do as the following to batch delete items from redis cache. (StackExchange.Redis.StrongName v1.0.488)
foreach (var ep in _muxer.GetEndPoints())
{
var server = _muxer.GetServer(ep);
var keys = server.Keys(database: _redisDatabase, pattern: pattern + "*").ToArray();
_db.KeyDeleteAsync(keys);
}
_muxer... | Redis | 26,488,830 | 22 |
Is SQL Server 2014's In-Memory OLTP (Hekaton) the same or similar concept with Redis?
I use Redis for in-memory storage (storage in RAM) and caching, while having a separate SQL Server database (like StackExchange does). Can Hekaton do the same thing?
| They're similar by both being primarily in-memory, but that's about it.
Redis is an in-memory key-value database. It can persist data to disk if configure it, but it keeps the entire dataset in memory so you need enough RAM for that. The key-value architecture allows various different data types so you can store a valu... | Redis | 25,402,890 | 22 |
I've looking around and I'm unable to find how to perform a subscription to keyspace notifications on Redis using StackExchange.Redis library.
Checking available tests I've found pubsub using channels, but this is more to work like a service bus/queueing rather than subscribing to specific Redis key events.
Is it possi... | The regular subscriber API should work fine - there is no assumption on use-cases, and this should work fine.
However, I do kinda agree that this is inbuilt functionality that could perhaps benefit from helper methods on the API, and perhaps a different delegate signature - to encapsulate the syntax of the keyapace not... | Redis | 23,180,765 | 22 |
Totally new to nodejs and redis. Node.js is working fine and NPM works fine too.
I want to play around with Redis so I ran:
npm install redis
and this seemed to work ok but now I'm trying to run:
redis-server
and I'm getting a Command Not Found error.
I'm on a Mac if that's relevant.
Can anyone offer some advice?
| npm install redis doesn't install redis, it installs a redis client for node. You need to install the redis server.
| Redis | 22,362,674 | 22 |
I haven't been able to find in the documentation on how the messages in a channel get stored in redis publish/subscribe.
When you publish to a redis channel, is that message stored or persisted? If so, how long is it stored and how do you get historical messages?
Otherwise, I'm assuming that it just broadcasts that me... | The pub/sub messages are not queued, and even less persisted.
They are only buffered in the socket buffers, and immediately sent to the subscribers in the same event loop iteration as the publication.
If a subscriber fails to read a message, this message is lost for the subscriber.
| Redis | 18,079,951 | 22 |
I'm currently bulding a web app and would like to use Redis to store sessions. At login, the session is inserted into Redis with a corresponding user id, and expiration set at 15 minutes. I would now like to implement reverse look-up for sessions (get sessions with a certain user id). The problem here is, since I can't... | On the current release branch of Redis (2.6), you cannot have notifications when items are expired. It will probably change with the next versions.
In the meantime, to support your requirement, you need to manually implement expiration notification support. So you have:
session:<sessionid> -> a hash storing your sessio... | Redis | 16,741,476 | 22 |
Redis recommends a method of using SET with optional parameters as a locking mechanism. I.e. SET lock 1 EX 10 NX will set a lock only if it does not already exists and it will expire after 10 second.
I'm using Node Redis, which has a set() method, but I'm not sure how to pass it the additional parameters to have the ke... | After reading the Node Redis source code, I found that all methods accept an arbitrary number of arguments. When an error about incorrect number of arguments is generated, this is generated by Redis not the node module.
My early attempts to supply multiple arguments were because I only had Redis 2.2.x installed, where ... | Redis | 15,861,424 | 22 |
Using the console, how can I tell if sidekiq is connected to a redis server? I want to be able to do something like this:
if (sidekiq is connected to redis) # psuedo code
MrWorker.perform_async('do_work', user.id)
else
MrWorker.new.perform('do_work', user.id)
end
| You can use Redis info provided by Sidekiq:
redis_info = Sidekiq.redis { |conn| conn.info }
redis_info['connected_clients'] # => "16"
Took it from Sidekiq's Sinatra status app.
| Redis | 15,843,637 | 22 |
In an relational database, i have an user table, an category table and an user-category table which do many to many relationship.
What's the form of this structure in Redis?
| With Redis, relationships are typically represented by sets. A set can be used
to represent a one-way relationship, so you need one set per object to
represent a many-to-many relationship.
It is pretty useless to try to compare a relational database model to Redis
data structures. With Redis, everything is stored in a ... | Redis | 10,907,942 | 22 |
I just wrote a simple piece of code to perf test Redis + gevent to see how async helps perforamance and I was surprised to find bad performance. here is my code. If you get rid of the first two lines to monkey patch this code then you will see the "normal execution" timing.
On a Ubuntu 12.04 LTS VM, I am seeing a t... | This is expected.
You run this benchmark on a VM, on which the cost of system calls is higher than on physical hardware. When gevent is activated, it tends to generate more system calls (to handle the epoll device), so you end up with less performance.
You can easily check this point by using strace on the script.
With... | Redis | 10,656,953 | 22 |
I've seen many people using Redis as a cache lately, why not Mongo? As far as I could tell Redis can set an expire date on an index, like memcache but otherwise are there any reasons not to use Mongo for this?
I ask as I'm doing a large join in MySQL and then changing the data after selecting it. I'm already using me... | A lot of people do use MongoDB for a low-medium grade cache and it works just great.
Because it offers more functionality than a simple key value store via ad-hoc queryability it isn't as pure of a caching layer as a memcache or redis (it can be slower to insert and retrieve data).
Extremely high performance is attaina... | Redis | 10,317,732 | 22 |
I'm currently playing around with Redis and i've got a few questions. Is it possible to get values from an array of keys?
Example:
users:1:name "daniel"
users:1:age "24"
users:2:name "user2"
users:2:age "24"
events:1:attendees "users:1", "users:2"
When i redis.get events:1:attendees it returns "users:1", "users:2"... | Doing a loop on the items and synchronously accessing each element is not very efficient. With Redis 2.4, there are various ways to do what you want:
by using the sort command
by using pipelining
by using variadic parameter commands
With Redis 2.6, you can also use Lua scripting, but this is not really required here.... | Redis | 10,155,398 | 22 |
Port 6379 is open on the server, and I can successfully run telnet localhost 6379 in SSH.
I tried both Predis/phpredis client library in PHP, but it still does not work:
Predis gives "Permission denied" error when opening socket to 6379.
phpredis gives "redis server went away".
| Problem solved, type:
/usr/sbin/setsebool httpd_can_network_connect=1
By default, SELinux does not allow Apache to make socket connections. More information can be found here.
| Redis | 8,765,848 | 22 |
I am currently testing insertion of keys in a database Redis (on local).
I have more than 5 millions keys and I have just 4GB RAM so at one moment I reach capacity of RAM and swap fill in (and my PC goes down)...
My problematic : How can I make monitoring memory usage on the machine which has the Redis database, and in... | Memory is a critical resource for Redis performance. Used memory defines total number of bytes allocated by Redis using its allocator (either standard libc, jemalloc, or an alternative allocator such as tcmalloc).
You can collect all memory utilization metrics data for a Redis instance by running “info memory”.
127.0... | Redis | 6,450,932 | 22 |
How do I start using Redis database with ASP.NET?
What I should install and what I should download?
I'm using Visual Studio 2008 with C#.
| FYI, both the:
RedisStackOverflow with C# Source Code and
RedisAdminUI with C# Source Code
are open source ASP.NET web applications that only use the ServiceStack.Redis C# client.
Here is an example of how you would use an Inversion of control (IoC) container to register a Redis client connection pool and its accompa... | Redis | 5,006,326 | 22 |
I want to scale my Node.js Socket application vertically and horizontally and I haven´t found a sophisticated solution yet.
My application has two use-cases:
Broadcast messages from one user to all others
Push messages from one user to a subset of users
On one hand, I´ve read that I need Redis for both cases togethe... | I'd say Kafka is a good fit for the horizontal scaling. It is a fairly sophisticated way of distributing a huge amount of events across servers (which at the end is what you want). This is a good read about it: https://engineering.linkedin.com/kafka/running-kafka-scale
Regarding the vertical scale, instead of socket.io... | Redis | 37,116,615 | 21 |
I have a Redis cluster of 6 instances, 3 master and 3 slaves. My ASP .NET Core application uses it as a cache. Sometimes I get such an error:
StackExchange.Redis.RedisTimeoutException: Timeout awaiting response (outbound=0KiB, inbound=5KiB, 5504ms elapsed, timeout is 5000ms), command=GET, next: GET CRM.UsersMainService... | As I can see from your exception message, your minimum worker process count is too low for the traffic you have.
WORKER: (Busy=10,Free=32757,Min=2,Max=32767)
You had 10 busy worker threads when this exception happened, while you had 2 worker threads for start.
When your application runs out of available threads to co... | Redis | 57,661,799 | 21 |
I would like to insert data into sorted set in redis using python to do complex queries like on range etc.
import redis
redisClient = redis.StrictRedis(host='localhost', port=6379,db=0)
redisClient.zadd("players",1,"rishu")
but when i run the the above piece of code ,i get the following error as
AttributeError: 'st... | @TheDude is almost close.
The newer version of redis from (redis-py 3.0), the method signature has changed.
Along with ZADD, MSET and MSETNX signatures were also changed.
The old signature was:
data = "hello world"
score = 1
redis.zadd("redis_key_name", data, score) # not used in redis-py > 3.0
The new signature is... | Redis | 53,553,009 | 21 |
I have seen answers in couple of threads but didn't work out for me and since my problem occurs occasionally, asking this question if any one has any idea.
I am using jedis version 2.8.0, Spring Data redis version 1.7.5. and redis server version 2.8.4 for our caching application.
I have multiple cache that gets saved i... | We were facing the same problem with RxJava, the application was running fine but after some time, no connections could be aquired from the pool anymore. After days of debugging we finally figured out what caused the problem:
redisTemplate.setEnableTransactionSupport(true)
somehow caused spring-data-redis to not relea... | Redis | 43,492,474 | 21 |
I am connecting to a Redis sentinel using the code given below
var Redis = require('ioredis');
var redis = new Redis({
sentinels: [{ host: '99.9.999.99', port: 88888 }],
name: 'mymaster'
});
I am setting the value of a key by using following code:
function (key, data) {
var dataInStringFormat = JSON.s... | It's documented
redis.set('key', 100, 'EX', 10)
Where EX and 10 stands for 10 seconds. If you want to use milliseconds, replace EX with PX
| Redis | 41,237,001 | 21 |
Suppose I have [Slave IP Address] which is the slave of [Master IP Address].
Now my master server has been shut down, and I need to set this slave to be master MANUALLY (WITHOUT using sentinel automatic failover, WITH redis command).
Is it possible doing this without restarting the redis service ? (and losing all the c... | use SLAVEOF NO ONE to promote a slave to master
http://redis.io/commands/slaveof
| Redis | 34,155,977 | 21 |
Please consider the following example
>>import redis
>>redis_db_url = '127.0.0.1'
>>r = redis.StrictRedis(host = redis_db_url,port = 6379,db = 0)
>>r.sadd('a',1)
>>r.sadd('a',2)
>>r.sadd('a',3)
>>r.smembers('a')
[+] output: set(['1', '3', '2'])
>>r.sadd('a',set([3,4]))
>>r.smembers('a')
[+] output: set(['1', '3', '2'... | When you see the syntax *values in an argument list, it means the function takes a variable number of arguments.
Therefore, call it as
r.sadd('a', 1, 2, 3)
You can pass an iterable by using the splat operator to unpack it:
r.sadd('a', *set([3, 4]))
or
r.sadd('a', *[3, 4])
| Redis | 31,035,274 | 21 |
We're using Redis to store various application configurations in a DB 0.
Is it possible to query Redis for every key/valuie pair within the database, without having to perform two separate queries and joining the key/value pairs yourself?
I would expect functionality similar to the following:
kv = redis_conn.getall()
#... | There are differences between different types in Redis, so you have to look at the data type to determine how to get the values from the key. So:
keys = redis.keys('*')
for key in keys:
type = redis.type(key)
if type == "string":
val = redis.get(key)
if type == "hash":
vals = redis.hgetall(k... | Redis | 19,282,580 | 21 |
I'm performing some analysis on a data stream and publishing the results on a Redis channel. Consumers subscribe to these channels and get real-time data feeds. All historical data analysis results are lost.
Now I want to add the ability to store historical data in Redis so that consumers can query this historical da... | Use redis sorted sets.
Sorted sets store data based on "scores", so in your case, just use a time stamp in millis; the data will be sorted automatically, allowing you to retrieve historical items using start/end date ranges, here's an example...
Add items to a sorted set...
zadd historical <timestamp> <dataValue>
..ad... | Redis | 17,153,154 | 21 |
We are deploying a large scale web application that uses only redis as a data store. I notice the the benchmark of our redis master is around 8000 transactions per second on EC2, far less than the stated benchmarks on dedicated hardware.
I understand that there is a performance penalty for running Redis on a virtual m... | EC2 is probably not the best environment to run Redis on virtualized hardware, but it is a popular one, and there are a number of points to know to get the best from Redis on this platform.
I'm one of the authors of http://redis.io/topics/benchmarks and http://redis.io/topics/latency which cover most of the topics I p... | Redis | 11,765,502 | 21 |
I am thinking about creating an open source data management web application for various types of data.
A privileged user must be able to
add new entity types (for example a 'user' or a 'family')
add new properties to entity types (for example 'gender' to 'user')
remove/modify entities and properties
These will be ... | The SQL or NoSQL choice is not your problem. You need to read little more about database design in general. As you said, you're not a database expert(and you don't need to be), but
you absolutely must study a little more the RDBMS paradigm.
It's a common mistake for amateur enthusiasts to choose a NoSQL solution. Somet... | Redis | 10,672,939 | 21 |
The documentation for transactions says:
"we may deprecate and finally remove transactions" and "everything you
can do with a Redis transaction, you can also do with a script"
http://redis.io/topics/transactions
But does it? I see a problem with this.
Within a transaction you can WATCH multiple variables, read thos... | Its true that lua scripts can do whatever transactions can, but I don't think Redis transactions are going away.
EVAL script does not let you watch variables
When an eval script is running, nothing else can run concurrently. So, watching variables is pointless. You can be sure that nobody else has modified the var... | Redis | 10,532,520 | 21 |
I'm trying to use redis for sessions in my express app.
I do the following:
var express = require('express');
var RedisStore = require('connect-redis')(express);
app.configure('development', function(){
app.use(express.session({ secret: "password",
store: new RedisStore({
... | Sessions won't work unless you have these 3 in this order:
app.use(express.cookieParser());
app.use(express.session());
app.use(app.router);
I'm not sure if router is mandatory to use sessions, but it breaks them if it's placed before them.
| Redis | 10,191,692 | 21 |
Using redis-rb in a Rails app, the following doesn't work:
irb> keys = $redis.keys("autocomplete*")
=> ["autocomplete_foo", "autocomplete_bar", "autocomplete_bat"]
irb> $redis.del(keys)
=> 0
This works fine:
irb> $redis.del("autocomplete_foo", "autocomplete_bar")
=> 2
Am I missing something obvious? The source is jus... | A little coding exploration of the way the splat operator works:
def foo(*keys)
puts keys.inspect
end
>> foo("hi", "there")
["hi", "there"]
>> foo(["hi", "there"])
[["hi", "there"]]
>> foo(*["hi", "there"])
["hi", "there"]
So passing in a regular array will cause that array to be evaluated as a single item, so th... | Redis | 6,061,996 | 21 |
I'm trying to use redis-store as my Rails 3 cache_store. I also have an initializer/app_config.rb which loads a yaml file for config settings. In my initializer/redis.rb I have:
MyApp::Application.config.cache_store = :redis_store, APP_CONFIG['redis']
However, this doesn't appear to work. If I do:
Rails.cache
in my... | After some research, a probable explanation is that the initialize_cache initializer is run way before the rails/initializers are. So if it's not defined earlier in the execution chain then the cache store wont be set. You have to configure it earlier in the chain, like in application.rb or environments/production.rb
M... | Redis | 5,810,289 | 21 |
I have an application which inserts record to a postgresql table and after the insert, I want to send a PUBLISH command to redis. Is it possible to pass an object of that record to redis' PUBLISH command so the subscriber on the other end will receive the object too?
| Redis has no meaning of "objects", all redis gets are bytes, specifically strings!
So when you want to publish an object you have to serialize it some way and deserialize it on the subscriber.
| Redis | 5,190,914 | 21 |
One of the decisions I need to make is what caching framework to use in my system. With so many to choose from, I am currently investigating redis, ehcache and memcached.
Can anyone point to performance benchmarks of these three particular frameworks? Also an overview of their features - I am particularly interested in... | A small feature comparison is here: http://toddrobinson.com/appfabric/appfabric-cache-feature-comparisons/
UPDATE 25.02.2016
Dead link fixed thanks to WebArchive.org: http://web.archive.org/web/20140205010302/http://toddrobinson.com/appfabric/appfabric-cache-feature-comparisons/
| Redis | 4,208,912 | 21 |
As far as Redis do not allow to reSet expire date to key (because of nans with replication) I'd like to know is there any method to check if key set to be expired or not?
Thank you
| Use the TTL command. If an expiration is set, it returns the number of seconds until the key expires; otherwise it returns -1.
| Redis | 2,888,340 | 21 |
I'm trying to connect to my local Redis server from inside a Docker container, but am unsuccessful. Here is the setup I have done so far:
I have Redis up an running on my host machine. I am able to connect to it via redis-cli.
I started an interactive Docker container from an Ubuntu image.
I have installed redis-too... | You should not connect to IP address of the container, but IP of the host (one you see on host for Docker bridge). Looking at your question it should be 172.17.0.1
| Redis | 47,376,417 | 20 |
I am using StackExchange.Redis in my application to store key/values. I need to flush the entire db now which Redis is using. I found a way via command
How do I delete everything in Redis?
but how can I do this with StackExchange.Redis? I was not able to find any method for that?
I searched for Empty, RemoveAll etc on ... | The easiest way is to use FlushDatabase method or FlushDatabaseAsync from IServer
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost,allowAdmin=true");
var server = redis.GetServer("localhost");
server.FlushDatabase();
| Redis | 35,452,081 | 20 |
I'm backing a real-time websocket server application with MongoDB.
The client base is growing, and single-threaded performance is no longer enough. I need a pub/sub layer to distribute messages across threads.
I would normally go for Redis, but since the app already uses MongoDB, I could avoid the dependency using tail... | Actually, they are very different beasts.
A MongoDB tailable cursor would work a bit like a queue. It can work with a capped collection so you do not have to explicitly delete items in the collection. It is quite efficient, but keep in mind that MongoDB will lock the whole collection (the database actually) at each wr... | Redis | 24,761,612 | 20 |
I've been tasked to work on a project for a client that has a site which he is estimating will receive 1-2M hits per day. He has an existing database of 58M users that need to get seeded on a per-registration basis for the new brand. Most of the site's content is served up from external API supplied data with most of t... | I would do a combination, and use Redis to cache session user API calls that have a short TTL, and use Nginx to cache long term RESTless data and static assets. I wouldn't write JSON files as I imagine the file system IO would be the slowest and most CPU intensive of the options listed.
| Redis | 15,555,896 | 20 |
I tried to use the Z axis data from SensorEvent.values, but it doesn't detect rotation of my phone in the XY plane, ie. around the Z-axis.
I am using this as a reference for the co-ordinate axes. Is it correct?
How do I measure that motion using accelerometer values?
These games do something similar: Extreme Skater, ... | Essentially, there is 2 cases here: the device is laying flat and not flat. Flat here means the angle between the surface of the device screen and the world xy plane (I call it the inclination) is less than 25 degree or larger than 155 degree. Think of the phone lying flat or tilt up just a little bit from a table.
Fir... | Tilt | 11,175,599 | 38 |
The Android game My Paper Plane is a great example of how to implement tilt controls, but I've been struggling to understand how I can do something similar.
I have the following example that uses getOrientation() from the SensorManager. The whole thing is on pastebin here. It just prints the orientation values to text ... | You mixed the accelerator and megnetic sensor arrays. The code should be:
if (SensorManager.getRotationMatrix(m_rotationMatrix, null,
m_lastAccels, m_lastMagFields)) {
Check out getRotationMatrix(..)
| Tilt | 4,576,493 | 25 |
I'm trying to create a sprockets preprocessor for Rails that finds .png.rb files in the asset pipeline and uses them to generate png screenshots of various pages in my application.
I've read up on this topic quite a bit but I can't seem to find any straightforward documentation on how to get this set up. Help, please?
... | Okay, I'm still not sure where to find documentation on this. But, by reading Sprockets' source code, playing around with the pry debugger, and reading blog posts from people who have done similar things with Sprockets, I was able to come up with this:
/initializers/sprockets.rb:
require 'screenshot_generator'
Rails.... | Tilt | 18,128,633 | 11 |
I have launched my application using the Quarkus dev mode (mvn quarkus:dev) and I would like to be able to debug it.
How can do that?
| When launching a Quarkus app simply using mvn quarkus:dev, the running application is configured to open port 5005 for remote debugging.
That means that all you have to do is point your remote debugger to that port and you will be able to debug it in your favorite IDE/lightweight editor.
If however you would like to be... | Quarkus | 55,190,015 | 53 |
First of all, I have a multi-module maven hierarchy like that:
├── project (parent pom.xml)
│ ├── service
│ ├── api-library
So now to the problem:
I am writing a JAX-RS Endpoint in the service module which uses classes in the api-library.
When I start quarkus, I am getting this warning:
13:01:18,784 WARN [io.qua.... | Quarkus automatically indexes the main module but, when you have additional modules containing CDI beans, entities, objects serialized as JSON, you need to explicitly index them.
There are a couple of different (easy to implement) options to do so.
Using the Jandex Maven plugin
Add the following to the pom.xml of the m... | Quarkus | 55,513,502 | 51 |
recently I swapped from thorntail to quarkus and I'm facing some difficulties trying to find how to set environment variables in application.properties in thorntail I used something like this ${env.HOST: localhost} that basically means put environment variable, if you don't find anything put localhost as default is tha... | In application.properties you can use:
somename=${HOST:localhost}
which will correctly expand the HOST environment variable and use localhost as the default value if HOST is not set.
See this for more information.
| Quarkus | 55,796,370 | 25 |
I have two apps running.
App1: Read from amq, enrich the message and send the message to App2 through other amq
App2: Read the message and call another project for processing.
Y want to debug booth Apps in the same time and see how the message change in time.
When I start the App2 with mvn compile quarkus:dev I got thi... | The -Ddebug system property can be used to specify a debug port as well. In your case, mvn compile quarkus:dev -Ddebug=5006 should work.
See this javadoc https://github.com/quarkusio/quarkus/blob/1.8.1.Final/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java#L140-L166 for more info.
| Quarkus | 55,289,627 | 22 |
I have some configurations in my application.properties file
...
quarkus.datasource.url=jdbc:postgresql://...:5432/....
quarkus.datasource.driver=org.postgresql.Driver
quarkus.datasource.username=user
quarkus.datasource.password=password
quarkus.hibernate-orm.database.generation=update
...
I have a scheduler with a @T... | Seems that this has changed -> it is now possible to set the Transaction timeout:
https://quarkus.io/guides/transaction
You can configure the default transaction timeout, the timeout that applies to all transactions managed by the transaction manager, via the property:
quarkus.transaction-manager.default-transaction-ti... | Quarkus | 56,746,385 | 21 |
When I use something like the following in my Quarkus application:
@Path("v1")
@Produces(APPLICATION_JSON)
public class HelloWorldResource {
@Inject
private SomeBean someBean;
}
then I get a warning the following during the build process.
[INFO] [io.quarkus.arc.processor.BeanProcessor] Found unrecommended usag... | If a property is package-private, Quarkus can inject it directly without requiring any reflection to come into play.
That is why Quarkus recommends package-private members for injection as it tries to avoid reflection as much as possible (the reason for this being that less reflection means better performance which is... | Quarkus | 55,101,095 | 21 |
As per the Quarkus documentation :
In Quarkus, the preferred datasource and connection pooling
implementation is Agroal.
But, I don't see any review or comparison of 'Agroal' with the well known JDBC Connection Pooling implementation 'HikariCP'.
What makes 'Agroal' better than 'HikariCP', except that BOTH Quarkus ... | With Agroal you can update configuration on runtime
Configuration property overridable at runtime
While Hikari doesn't support it
You can't dynamically update the property values by resetting them on the config object
Another reason is Quarkus integration
features first class integration with the other component... | Quarkus | 60,137,423 | 19 |
I have one project to parse some info from a large file.
The project uses maven and java:
And the structure bellow:
When I run the application from my IDEA, I can read the file with:
public void buffer() throws IOException {
try (InputStream inputStream = getClass().getResourceAsStream("/151279.txt");
... | You need to make sure that the resource is included in the native image (it isn't by default).
Add a src/main/resources/resources-config.json that includes something like:
{
"resources": [
{
"pattern": "151279\\.txt$"
}
]
}
You will also need to set the following property:
quarkus.native.additional-b... | Quarkus | 60,711,034 | 16 |
I plan to use PostgreSQL as the database for my Quarkus application but I would like the convenience of using H2 in my tests.
Is there a way I can accomplish such a feat?
| Update 2
Recent versions of Quarkus can launch H2 automatically in dev and test mode when quarkus-jdbc-h2 is on the classpath and no URL configuration is provided.
See this for more information.
Also, you should favor the datasource "kind" when configuring the driver, instead of pointing to a driver explicitly.
In shor... | Quarkus | 55,063,778 | 16 |
Apologies if it has been answered before, but I can't seem to find a good answer.
What is the context of how @QuarkusTest runs versus QuarkusIntegrationTest?
So far, all I got is the integration test runs against a packaged form of the app (.jar, native compilation), whereas the plain @QuarkusTest doesn't? But this doe... | Besides the difference you mention, there's another crucial difference between @QuarkusTest and @QuarkusIntegrationTest. With @QuarkusTest, the test runs in the same process as the tested application, so you can inject the application's beans into the test instance etc., while with @QuarkusIntegrationTest, the tested a... | Quarkus | 71,022,392 | 15 |
I would like my Quarkus application to run on a port other than the default. How can I accomplish that?
| The Quarkus configuration property to be used is quarkus.http.port (the default value is 8080).
If this property is set in application.properties then that value will be used.
The property can also be overridden at runtime as follows:
When running a Quarkus application in JVM mode you can set the port using the quarkus... | Quarkus | 55,043,620 | 15 |
As Spring boot application provides a property to set the web console URL of the H2 Database.
spring.h2.console.path=/h2
Is there a way to set this same property in the Quarkus application? If not then what is the default
web console URL.
| Yes, there is a way. But it's not quite as simple as in Spring Boot because Quarkus does not do the same first-class support for H2 as Spring Boot does.
First, you need to activate Servlet support in Quarkus. Then, you go ahead and configure the H2 servlet in a web.xml deployment descriptor or in a undertow-handlers.co... | Quarkus | 61,853,691 | 14 |
I've created a quarkus quick start project with
mvn io.quarkus:quarkus-maven-plugin:0.13.1:create \
-DprojectGroupId=com.demo.quarkus \
-DprojectArtifactId=quarkus-project \
-DclassName="com.demo.quarkus.HelloResource" \
-Dpath="/hello"
And afterwards when I run:
mvn clean package
I get the following ... | It seems that besides the normal HTTP port, there is also a default port used during tests. So in order to override the default port used in tests, the following property needs to be overridden:
quarkus.http.test-port=8888
This will run the rests using port 8888.
The answer for this question pointed me in the right di... | Quarkus | 57,095,830 | 14 |
When I run my Quarkus application it listens/binds to localhost only by default.
How can I alter this behavior?
| UPDATE
With the inclusion of this PR in Quarkus, starting with version 0.12.0 the configuration explained in the following section will no longer be needed since Quarkus will use 0.0.0.0 as the default host.
By default Quarkus only listens on localhost (127.0.0.1). To make Quarkus listen on all network interfaces (som... | Quarkus | 55,043,764 | 14 |
I have a value configured in my quarkus application.properties
skipvaluecheck=true
Now whenever I want to execute my tests, I want to have this value to be set to false instead of true. But I do not want to change in application.properties because it will affect the latest application deployment. I just want my tests ... | You need to define an implementation of io.quarkus.test.junit.QuarkusTestProfile and add it to the test via @TestProfile.
Something like:
@QuarkusTest
@TestProfile(MyTest.BuildTimeValueChangeTestProfile.class)
public class MyTest {
@Test
public void testSomething() {
}
public static class BuildTime... | Quarkus | 69,267,442 | 13 |
I am looking for a way to change the log level of one or multiple classes/packages of a Quarkus app (JVM) during runtime. Is there an API I can use to programmatically change the levels, e.g. by exposing a REST API or does there already exist some other solution?
I am aware of https://quarkus.io/guides/logging but this... | Apparently Quarkus uses java.util.logging under the hood, so I created a simple REST resource like this:
import javax.ws.rs.*;
import java.util.logging.*;
@Path("/logging")
public class LoggingResource {
private static Level getLogLevel(Logger logger) {
for (Logger current = logger; current != null;) {
... | Quarkus | 63,250,947 | 13 |
I would like to add an HTTP interceptor to my Quarkus application so I can intercept all HTTP requests.
How can such that be achieved?
| Quarkus uses RESTEasy as its JAX-RS engine. That means that you can take advantage of all of RESTEasy's features, including Filters and Interceptors.
For example to create a very simple security mechanism, all you would need to do is add code like the following:
@Provider
public class SecurityInterceptor implements Con... | Quarkus | 56,448,061 | 13 |
I am using Quarkus application with the Hibernate extension and I would like Hibernate to show the generated SQL query. I am not sure how that could be accomplished.
What's the best way to accomplish that? What's the proper way to configure such a feature?
| The Quarkus property that controls this behavior is quarkus.hibernate-orm.log.sql (which is set to false by default).
By simply setting quarkus.hibernate-orm.log.sql=true in application.properties, Quarkus will show and format the SQL queries that Hibernate issues to the database.
Note that the Hibernate configuration ... | Quarkus | 55,044,148 | 13 |
I'm getting this error below when I try to call a DynamoDB AWS service:
Multiple HTTP implementations were found on the classpath. To avoid non-deterministic loading implementations, please explicitly provide an HTTP client via the client builders, set the software.amazon.awssdk.http.service.impl system property with t... | Sorted out!
I added the parameter in dynamodbclient and it worked.
.httpClient(UrlConnectionHttpClient.builder().build())
| Quarkus | 73,129,078 | 12 |
In Spring, it is possible to set the Logging Category Level via environment variables. I've tried the same in a Quarkus application with the following logger declaration:
package org.my.group.resteasyjackson;
public class JacksonResource {
private static final Logger LOGGER = LoggerFactory.getLogger(JacksonResource... | Just tried with quarkus 1.13.1 and adding extra underscores for the quotes seems to work, try:
QUARKUS_LOG_CATEGORY__ORG_MY__LEVEL=WARN
| Quarkus | 65,503,420 | 12 |
When starting a quarkus jar, I don't see any server starting up, all I see is:
C:\Java Projects\quarkus-demo\target>java -jar quarkus-demo-1.0-SNAPSHOT-runner.jar
2020-01-04 18:25:54,199 WARN [io.qua.net.run.NettyRecorder] (Thread-1) Localhost lookup took more than one second, you ne
ed to add a /etc/hosts entry to im... | Quarkus uses Vert.x/Netty.
From https://developers.redhat.com/blog/2019/11/18/how-quarkus-brings-imperative-and-reactive-programming-together/:
Quarkus uses Vert.x and Netty at its core. And, it uses a bunch of
reactive frameworks and extensions on top to help developers. Quarkus
is not just for HTTP microservices... | Quarkus | 59,592,676 | 12 |
In the Quarkus Application Configuration Guide it mentions how to configure an app with profiles (eg. %dev.quarkus.http.port=8181).
But is there a way to access a Profile (or Environment) API so I can log the active profiles ? For example something like Spring:
@ApplicationScoped
public class ApplicationLifeCycle {
... | ProfileManager.getActiveProfile()?
| Quarkus | 56,617,504 | 12 |
Quarkus getting started unittest describes how to mock injected services. However when trying to apply this to an injected rest client this does not seem to work.
In my application the class attribute to be injected is defined like this
@Inject
@RestClient
MyService myService;
In my test code I created a mock se... | I just hit the same problem. There seems to have updates in the documentation and some corner cases that I faced, but google search sent me here first so I'll add my investigation results for future readers.
According to the documentation you already do not need creating mock class
https://quarkus.io/guides/getting-sta... | Quarkus | 56,393,462 | 12 |
I want to send a simple POST request to another application to trigger some action there.
I have a quarkus project and want to send the request from inside my CreateEntryHandler - is this possible in a simple way? Or do I need to add something like Apache Httpclient to my project? Does it make sense in combination with... | The other application, I assume has an API Endpoint?
Lets state that the API endpoint you are trying to call in the other app is:
POST /v1/helloworld
From your Quarkus Application, you will have to do the following:
Register a RestClient *As a Service
Specify the Service information in your configuration properties
In... | Quarkus | 66,347,707 | 11 |
Im currently working with Quarkus and Swagger-UI as delivered by quarkus-smallrye-openapi.
We have OIDC from Azure AD as security, which is currently not supported by Swagger-UI (see Swagger-Docs), so I can't add the "real" authorization to swagger.
This means, I can't use Swagger since my endpoints are at least secure... |
Register security scheme
@Path("/sample")
@SecuritySchemes(value = {
@SecurityScheme(securitySchemeName = "apiKey",
type = SecuritySchemeType.HTTP,
scheme = "Bearer")}
)
public class SampleResource {
Mark the operation's security requirement with the scheme n... | Quarkus | 64,154,593 | 11 |
Due to security concerns, my company doesn't allows to use containers on our laptops.
So we can't use the normal quarkus:dev to run our test that connects to Postgresql.
But they provides us a remote machine where we can use Podman to run some containers.
What I'm doing now is to manually ssh to that machine and starti... | This is a common scenario, and the intention of Quarkus's developer joy features is to allow it to work in a frictionless way, without requiring scripts or manual tunneling.
There are two options, although which one works best for you will depend a bit on how your company's remote podman is set up.
Remote dev services... | Quarkus | 78,259,962 | 10 |
I dusted off an old Java project implemented with Quarkus and updated the dependencies to Quarkus 2.4.0. However, I've noticed that when I start the application it also fires up a Docker PostgreSQL container. I have another DB for testing, so I don't need Quarkus to create one for me. I couldn't locate any configura... | You can use quarkus.devservices.enabled=false to disable all DevServices, or use the specific properties for each one - which in your case would be quarkus.datasource.devservices.enabled=false
| Quarkus | 69,919,634 | 10 |
I am trying to debug a basic Quarkus app by running the command ./mvnw compile quarkus:dev on IntelliJ (as stated in the Quarkus docs) and it seems to run ok (gives me the following message: Listening for transport dt_socket at address: 5005)
I can call the APIs on port 8080 and all fine but when I try to call the same... | One process can listen on multiple TCP/IP sockets for multiple things.
The debug port is the port 5005 where you attach the remote debugger to.
The API calls still need to go to port 8080, though. When you hit a breakpoint, you will see it in your debugger.
| Quarkus | 69,900,521 | 10 |
I'm doing some tests with Quarkus and PanacheRepository and I'm getting trouble in update an entity data. The update doesn't work, the field values are not updated.
In short: I create an entity and persist the data, after that in another request I get the entity from database using repository.findById(id);, change some... | Please consider accessing your entity using getter/setter, so Hibernate Proxies will work properly.
@Entity
public class Person {
@Id @GeneratedValue public Long id;
private String name; // <--- private field
public void setName(String name) {
this.name = name;
}
@Override
publi... | Quarkus | 64,503,946 | 10 |
While migrating my JAX-RS application from Jersey to Quarkus/Resteasy, I came across a behavior change with the method evaluatePreconditions(Date lastModified). Indeed, in my use case, the last modified date contains milliseconds and unfortunately the date format of the headers If-Modified-Since and Last-Modified doesn... | The implementation of Request.evaluatePreconditions(Date lastModified) at Resteasy 4.5 is wrong. The implementation at class org.jboss.resteasy.specimpl.RequestImpl relies on a helper class DateUtil which expect the Last-Modified header to be in one of the formats: RFC 1123 "EEE, dd MMM yyyy HH:mm:ss zzz", RFC 1036 "EE... | Quarkus | 64,170,860 | 10 |
I'm trying to resolve dependency injection with Repository Pattern using Quarkus 1.6.1.Final and OpenJDK 11.
I want to achieve Inject with Interface and give them some argument(like @Named or @Qualifier ) for specify the concrete class, but currently I've got UnsatisfiedResolutionException and not sure how to fix it.
H... | My guess is that you need to add a scope annotation to your ProductStockDummyRepository. Probably either @Singleton or @ApplicationScoped.
| Quarkus | 63,412,802 | 10 |
Trying out testcontainers for integration testing. I am testing rest api endpoint. Here is the technology stack -
quarkus, RESTEasy and mongodb-client
I am able to see MongoDB container is started successfully but getting exception. Exception: "com.mongodb.MongoSocketOpenException: Exception opening socket"
2020-04-26... | I can't say for certain without seeing your test configuration, but I'm guessing that it works with docker run and not Testcontainers because docker run exposes a fixed port (always 27017) but Testcontainers will expose port 27017 as a random port (to avoid port conflicts on test machines).
To use Testcontainers with a... | Quarkus | 61,447,252 | 10 |
I´ve implemented JWT RBAC in my Quarkus application, but I don´t want to provide tokens whenever I´m testing my application locally.
EDIT:
What I´ve tried so far are setting these properties to "false" without any effect.
quarkus.oauth2.enabled=false
quarkus.security.enabled=false
quarkus.smallrye-jwt.enabled=false
Cu... | You can implement an AuthorizationController (io.quarkus.security.spi.runtime.AuthorizationController)
public class DisabledAuthController extends AuthorizationController {
@ConfigProperty(name = "disable.authorization")
boolean disableAuthorization;
@Override
public boolean isAuthorizationEnabled() {
... | Quarkus | 59,774,964 | 10 |
I would like to change the logging level of my Quarkus application.
How can I do that either from the configuration file or at runtime?
| The property that controls the root logging level is quarkus.log.level (and defaults to INFO).
This property can be set either in application.properties or can be overridden at runtime using -Dquarkus.log.level=DEBUG.
You can also specify more fine grained logging using quarkus.log.category.
For example for RESTEasy y... | Quarkus | 55,044,060 | 10 |
I would like to override the properties I have configured in my configuration file in my Quarkus application.
How can I accomplish that?
| Properties in Quarkus are generally configured in src/main/resources/application.properties.
This is true both for properties that configure the behavior of Quarkus (like the http port it listens to or the database URL to connect to for example) and properties that are specific to your application (for example a greeti... | Quarkus | 55,043,399 | 10 |
How do I squash my last N commits together into one commit?
| You can do this fairly easily without git rebase or git merge --squash. In this example, we'll squash the last 3 commits.
If you want to write the new commit message from scratch, this suffices:
git reset --soft HEAD~3
git commit
If you want to start editing the new commit message with a concatenation of the existing ... | Squash | 5,189,560 | 5,492 |
This gives a good explanation of squashing multiple commits:
http://git-scm.com/book/en/Git-Branching-Rebasing
but it does not work for commits that have already been pushed. How do I squash the most recent few commits both in my local and remote repos?
When I do git rebase -i origin/master~4 master, keep the first one... | Squash commits locally with:
git rebase -i origin/master~4 master
where ~4 means the last 4 commits.
This will open your default editor. Here, replace pick in the second, third, and fourth lines (since you are interested in the last 4 commits) with squash. The first line (which corresponds to the newest commit) should... | Squash | 5,667,884 | 859 |
How do you squash your entire repository down to the first commit?
I can rebase to the first commit, but that would leave me with 2 commits.
Is there a way to reference the commit before the first one?
| As of git 1.6.2, you can use git rebase --root -i
For each commit except the first, change pick to squash in the editor that pops up.
| Squash | 1,657,017 | 785 |
With git rebase --interactive <commit> you can squash any number of commits together into a single one.
That's all great unless you want to squash commits into the initial commit. That seems impossible to do.
Are there any ways to achieve it?
Moderately related:
In a related question, I managed to come up with a diffe... | Update July 2012 (git 1.7.12+)
You now can rebase all commits up to root, and select the second commit Y to be squashed with the first X.
git rebase -i --root master
pick sha1 X
squash sha1 Y
pick sha1 Z
git rebase [-i] --root $tip
This command can now be used to rewrite all the history leading from "$tip" down to ... | Squash | 598,672 | 692 |
I'm trying to understand the difference between a squash and a rebase. As I understand it, one performs a squash when doing a rebase.
| Merge commits: retains all of the commits in your branch and interleaves them with commits on the base branch
Merge Squash: retains the changes but omits the individual commits from history
Rebase: This moves the entire feature branch to begin on the tip of the master branch, effectively incorporating all of the new c... | Squash | 2,427,238 | 619 |
I've been using Git Extensions for a while now (it's awesome!) but I haven't found a simple answer to the following:
Sometimes, when typing a commit message, a make a typo. My friend showed me how to fix it the following way (in Git Extentions):
Right-Click on the commit > Advanced > Fixup commit
Then I simply check... | I do not know what Git Extensions does with it specifically, but git rebase has an option to automatically squash or fixup commits with squash! or fixup! prefixes, respectively:
--autosquash, --no-autosquash
When the commit log message begins with "squash! ..." (or "fixup!
..."), and there is a commit ... | Squash | 16,758,131 | 199 |
I've got eight commits on a branch that I'd like to email to some people who aren't git enlightened, yet. So far, everything I do either gives me 8 patch files, or starts giving me patch files for every commit in the branch's history, since the beginning of time. I used git rebase --interactive to squash the commits,... | I'd recommend doing this on a throwaway branch as follows. If your commits are in the "newlines" branch and you have switched back to your "master" branch already, this should do the trick:
[adam@mbp2600 example (master)]$ git checkout -b tmpsquash
Switched to a new branch "tmpsquash"
[adam@mbp2600 example (tmpsquash... | Squash | 616,556 | 182 |
I'm trying to squash a range of commits - HEAD to HEAD~3. Is there a quick way to do this, or do I need to use rebase --interactive?
| Make sure your working tree is clean, then
git reset --soft HEAD~3
git commit -m 'new commit message'
| Squash | 7,275,508 | 147 |
I made a pull request on GitHub. Now the owner of the repository is saying to squash all the commits into one.
When I type git rebase -i Notepad opens with the following content:
noop
# Rebase 0b13622..0b13622 onto 0b13622
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# ... | Just a simple addition to help someone else looking for this solution. You can pass in the number of previous commits you would like to squash. for example,
git rebase -i HEAD~3
This will bring up the last 3 commits in the editor.
| Squash | 14,534,397 | 101 |
Here's a workflow that I commonly deal with at work.
git checkout -b feature_branch
# Do some development
git add .
git commit
git push origin feature_branch
At this point the feature branch is up for review from my colleagues, but I want to keep developing on other features that are dependent on feature_branch. So w... | A little bit about why this happens:
I'll let O be "original master" and FB be "new master", after a feature branch has been merged in:
Say feature_branch looks like:
O - A - B - C
dependent_feature has a few extra commits on top of that:
O - A - B - C - D - E - F
You merge your original feature branch into master a... | Squash | 22,593,087 | 101 |
In Docker 1.13 the new --squash parameter was added.
I'm now hoping to reduce the size of my images as well as being able to "hide" secret files I have in my layers.
Below you can now see the difference from doing a build with and without the --squash parameter.
Without Squash
With Squash
Now to my question.
If I add... |
If I add a secret file in my first layer, then use the secret file in
my second layer, and the finally remove my secret file in the third
layer, and then build with the --squash flag.
Will there be any way now to get the secret file?
Answer: Your image won't have the secret file.
How --squash works:
Once the build is... | Squash | 41,764,336 | 91 |
Which one should one use to hide microcommits?
Is the only difference between git merge --squash and git merge --no-ff --no-commit the denial of the other parents?
| The differences
These options exists for separate purposes. Your repository ends up differently.
Let's suppose that your repository is like this after you are done developing on the topic branch:
--squash
If you checkout master and then git merge --squash topic; git commit -m topic, you get this:
--no-ff --no-commi... | Squash | 11,983,749 | 83 |
As the title says, I am not really clear about the differences between a git merge --squash and a git merge --no-commit.
As far as I understand the help page for git merge, both commands would leave me in an updated working-tree, where it is still possible to edit and then to do a final commit (or multiple commits).
Co... | git merge --no-commit
This is just like a normal merge but doesn't create a merge-commit. This commit will be a merge commit: when you look at the history, your commit will appear as a normal merge.
git merge --squash
This will merge the changes into your working tree without creating a merge commit. When you commit ... | Squash | 9,599,411 | 70 |
A common development workflow for us is to checkout branch b, commit a bunch to it, then squash all those commits into one (still on b).
However, during the rebase -i process to squash all the commits, there are frequently conflicts at multiple steps.
I essentially want to alter the branch into one commit that represen... | If you don't need the commit information, then you could just do a soft reset. Then files remain as they were and when you commit, this commit will be on top of the commit you did reset to.
To find the commit to reset to:
git merge-base HEAD BRANCH_YOU_BRANCHED_FROM
Then
git reset --soft COMMIT_HASH
Then re-craft the... | Squash | 17,354,353 | 51 |
I merged an upstream of a large project with my local git repo. Prior to the merge I had a small amount of history that was easy to read through, but after the merge a massive amount of history is now in my repo. I have no need for all the history commits from the upstream repo.
There have been other commits made after... | I was able to squash several commits after multiple merges from the master branch using the strategy found here: https://stackoverflow.com/a/17141512/1388104
git checkout my-branch # The branch you want to squash
git branch -m my-branch-old # Change the name to something old
git checkout master ... | Squash | 14,043,961 | 45 |
I'm trying to use the git merge --squash with the --no-ff parameter, but git does not allow.
Someone have any sugestion to help me?
I can't use fast forward merge and I need to use the --squash parameter to group a lot of commits that were made in another branch.
Thanks!
| It probably doesn't let you because such a command wouldn't make sense.
The documentation for --squash says (emphasis mine):
--squash
Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit or move the HEAD, nor record GIT_DIR/MERG... | Squash | 14,321,748 | 39 |
If I'm in the following situation,
$ git log --oneline
* abcdef commit #b
* 123456 commit #a
I know I can always run
$ git reset HEAD~
$ git commit --amend
However, I tried to run
$ git rebase -i HEAD~2
but I got
fatal: Needed a single revision
invalid upstream HEAD~2
Hence my question: is there a way to use git r... | You want to rebase to the root commit of your master branch. More specifically, to squash the two commits, you need to run
git rebase -i --root
and then substitute squash for pick on the second line in the buffer of the editor that pops up:
pick 123456 a
squash a... | Squash | 30,277,149 | 36 |
I have a branch with about 20 commits.
The first SHA on the branch is bc3c488...
The last SHA on the branch is 2c2be6...
How can I merge all the commits together?
I want to do this without using interactive rebase as there are so many commits.
I need this for a github Pull Request where I am being asked to merge my com... | If the first SHA is HEAD you can also use this approach:
git reset --soft $OLD_SHA; git add -A; git commit --amend --no-edit
be careful, this command will change the history of the repo.
If you want to squash commits that are in the middle of your history:
|---* --- 0 --- 1 ---- 2 --- 3 --- * --- * --- * --- HEAD
lik... | Squash | 33,901,565 | 34 |
I'm trying to rebase and squash all my commits from current branch to master. Here is what I'm trying to do:
git checkout -b new-feature
make a couple of commits, after it I was trying:
git rebase -i master
in this case commits will remain in new-feature branch
git checkout master
git rebase -i new-feature
It gives ... | Lets go though the steps.
1 - We create a new feature branch
git checkout -b new-feature
2 - Now you can add/remove and update whatever you want on your new branch
git add <new-file>
git commit -am "Added new file"
git rm <file-name>
git commit -am "Removed a file"
cat "add more stuff to file" >> <new-file>
git commit... | Squash | 15,727,597 | 30 |
git branch --merged doesn't appear to play nicely with --squash.
If you do a normal git merge, then git branch --merged tells you which branches have been merged. This is not the case however if the --squash option is used, even though the resulting tree is the same.
I doubt this is a git defect and would like to know... | You can't get there from here (as the fellow giving directions said). More precisely, it does not make sense.
The problem is that git merge --squash does not actually do a merge. Suppose your branch history looks like this, for instance (with branches topic and devel):
H ⬅ I ⬅ J <-- topic
⬋
⬅ F ... | Squash | 19,308,790 | 30 |
What is the difference between amend and squash commands? I tried both and found that both are doing the same for proper management.
| In Git, commits are rarely actual destroyed, they just become orphans, or detached, meaning that they are not pointed to or reachable by a reference like a branch or tag.
"amending" and "squashing" are similar concepts though.
Typically, amending is a single commit operation in which you want to combine work that you h... | Squash | 35,044,229 | 24 |
I have the following git workflow:
Create new feature branch
Work on feature branch
Commit often
Once feature is complete, merge into master branch
Rinse and repeat
However, sometimes, I have the need to revert a whole feature from master. This could involve a whole lot of reverting. (The reason for needing to revert... | You should look at leveraging the squash merge capability of git i.e. git merge --squash, so that you do not rewrite history unnecessarily.
Both git merge --squash and git rebase --interactive can be used to produce a squashed commit with the same resultant work-tree, but they are intended to serve 2 totally different ... | Squash | 16,449,029 | 20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.